function MenuActiveTrailsCacheContext::__construct

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php \Drupal\Core\Cache\Context\MenuActiveTrailsCacheContext::__construct()

Constructs a MenuActiveTrailsCacheContext object.

Parameters

\Drupal\Core\Menu\MenuActiveTrailInterface|null $menuActiveTrailService: The menu active trail service.

File

core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php, line 19

Class

MenuActiveTrailsCacheContext
Defines the MenuActiveTrailsCacheContext service.

Namespace

Drupal\Core\Cache\Context

Code

public function __construct(?MenuActiveTrailInterface $menuActiveTrailService = NULL) {
    if ($this->menuActiveTrailService === NULL) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $menuActiveTrailService argument is deprecated in drupal:10.2.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3397515', E_USER_DEPRECATED);
        $this->menuActiveTrailService = \Drupal::service('menu.active_trail');
    }
}

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