You are here

class MenuTokenSubscriber in Menu Token 8

Same name and namespace in other branches
  1. 9.1.x src/EventSubscriber/MenuTokenSubscriber.php \Drupal\menu_token\EventSubscriber\MenuTokenSubscriber

Event Subscriber MenuTokenSubscriber.

Hierarchy

  • class \Drupal\menu_token\EventSubscriber\MenuTokenSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of MenuTokenSubscriber

1 string reference to 'MenuTokenSubscriber'
menu_token.services.yml in ./menu_token.services.yml
menu_token.services.yml
1 service uses MenuTokenSubscriber
menu_token.event_subscriber in ./menu_token.services.yml
Drupal\menu_token\EventSubscriber\MenuTokenSubscriber

File

src/EventSubscriber/MenuTokenSubscriber.php, line 13

Namespace

Drupal\menu_token\EventSubscriber
View source
class MenuTokenSubscriber implements EventSubscriberInterface {
  protected $currentUser;
  protected $cache;
  protected $contextRepository;
  protected $menuTokenContextManager;

  /**
   * MenuTokenSubscriber constructor.
   *
   * @param \Drupal\menu_token\Service\MenuTokenContextManager $menuTokenContextManager
   *   Menu token context manager.
   */
  public function __construct(MenuTokenContextManager $menuTokenContextManager) {
    $this->menuTokenContextManager = $menuTokenContextManager;
  }

  /**
   * The CONTROLLER event occurs once a controller was found.
   *
   * @param \Symfony\Component\HttpKernel\Event\FilterControllerEvent $event
   *   The controller event.
   *
   *   For handling a request. Constant KernelEvents::CONTROLLER.
   */
  public function onController(FilterControllerEvent $event) {
    $this->menuTokenContextManager
      ->replaceContextualLinks();
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[KernelEvents::CONTROLLER][] = [
      'onController',
    ];
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MenuTokenSubscriber::$cache protected property
MenuTokenSubscriber::$contextRepository protected property
MenuTokenSubscriber::$currentUser protected property
MenuTokenSubscriber::$menuTokenContextManager protected property
MenuTokenSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
MenuTokenSubscriber::onController public function The CONTROLLER event occurs once a controller was found.
MenuTokenSubscriber::__construct public function MenuTokenSubscriber constructor.