diff --git a/core/modules/toolbar/lib/Drupal/toolbar/Routing/ToolbarController.php b/core/modules/toolbar/lib/Drupal/toolbar/Routing/ToolbarController.php index f2dfab2..3a7eb3c 100644 --- a/core/modules/toolbar/lib/Drupal/toolbar/Routing/ToolbarController.php +++ b/core/modules/toolbar/lib/Drupal/toolbar/Routing/ToolbarController.php @@ -8,42 +8,14 @@ namespace Drupal\toolbar\Routing; use Drupal\Core\Access\AccessInterface; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Session\AccountInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Controller\ControllerBase; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; /** * Defines a controller for the toolbar module. */ -class ToolbarController implements ContainerInjectionInterface { - - /** - * The current user. - * - * @var \Drupal\Core\Session\AccountInterface - */ - protected $user; - - /** - * Constructs a new ToolbarController instance. - * - * @param \Drupal\Core\Session\AccountInterface $user - * The current user. - */ - public function __construct(AccountInterface $user) { - $this->user = $user; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('current_user') - ); - } +class ToolbarController extends ControllerBase { /** * Returns the rendered subtree of each top-level toolbar link. @@ -63,7 +35,7 @@ public function subtreesJsonp() { */ public function checkSubTreeAccess(Request $request) { $hash = $request->get('hash'); - return ($this->user->hasPermission('access toolbar') && ($hash == _toolbar_get_subtrees_hash())) ? AccessInterface::ALLOW : AccessInterface::DENY; + return ($this->currentUser()->hasPermission('access toolbar') && ($hash == _toolbar_get_subtrees_hash())) ? AccessInterface::ALLOW : AccessInterface::DENY; } }