function NodeAccessGrantsCacheContext::__construct

Constructs a new UserCacheContextBase class.

Parameters

\Drupal\Core\Session\AccountInterface $user: The current user.

Overrides UserCacheContextBase::__construct

File

core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php, line 25

Class

NodeAccessGrantsCacheContext
Defines the node access view cache context service.

Namespace

Drupal\node\Cache

Code

public function __construct(AccountInterface $user, protected ?EntityTypeManagerInterface $entityTypeManager = NULL) {
  parent::__construct($user);
  if (!$entityTypeManager) {
    @trigger_error('Calling NodeAccessGrantsCacheContext::__construct() without the $entityTypeManager argument is deprecated in drupal:11.3.0 and the $entityTypeManager argument will be required in drupal:12.0.0. See https://www.drupal.org/node/3038909', E_USER_DEPRECATED);
    $this->entityTypeManager = \Drupal::entityTypeManager();
  }
}

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