function MenuRouterRebuildSubscriber::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php \Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber::__construct()
  2. 8.9.x core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php \Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber::__construct()
  3. 11.x core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php \Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber::__construct()

Constructs the MenuRouterRebuildSubscriber object.

Parameters

\Drupal\Core\Lock\LockBackendInterface $lock: The lock backend.

\Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager: The menu link plugin manager.

\Drupal\Core\Database\Connection $connection: The database connection.

\Drupal\Core\Database\ReplicaKillSwitch $replica_kill_switch: The replica kill switch.

\Psr\Log\LoggerInterface|null $logger: The logger.

File

core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php, line 60

Class

MenuRouterRebuildSubscriber
Rebuilds the default menu links and runs menu-specific code if necessary.

Namespace

Drupal\Core\EventSubscriber

Code

public function __construct(LockBackendInterface $lock, MenuLinkManagerInterface $menu_link_manager, Connection $connection, ReplicaKillSwitch $replica_kill_switch, ?LoggerInterface $logger = NULL) {
    $this->lock = $lock;
    $this->menuLinkManager = $menu_link_manager;
    $this->connection = $connection;
    $this->replicaKillSwitch = $replica_kill_switch;
    if ($this->logger === NULL) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $logger argument is deprecated in drupal:10.1.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/2932520', E_USER_DEPRECATED);
        $this->logger = \Drupal::service('logger.channel.menu');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.