function BookNavigationCacheContext::__construct

Same name and namespace in other branches
  1. 9 core/modules/book/src/Cache/BookNavigationCacheContext.php \Drupal\book\Cache\BookNavigationCacheContext::__construct()
  2. 8.9.x core/modules/book/src/Cache/BookNavigationCacheContext.php \Drupal\book\Cache\BookNavigationCacheContext::__construct()
  3. 11.x core/modules/book/src/Cache/BookNavigationCacheContext.php \Drupal\book\Cache\BookNavigationCacheContext::__construct()

Constructs a new BookNavigationCacheContext service.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.

\Drupal\book\BookManagerInterface|null $bookManagerService: The book manager service.

File

core/modules/book/src/Cache/BookNavigationCacheContext.php, line 37

Class

BookNavigationCacheContext
Defines the book navigation cache context service.

Namespace

Drupal\book\Cache

Code

public function __construct(RouteMatchInterface $route_match, ?BookManagerInterface $bookManagerService = NULL) {
    $this->routeMatch = $route_match;
    if ($this->bookManagerService === NULL) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $bookManagerService 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->bookManagerService = \Drupal::service('book.manager');
    }
}

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