You are here

public function IsCurrentUserPageCacheContext::__construct in Opigno dashboard 3.x

IsCurrentUserPageCacheContext constructor.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The rote match service.

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

File

src/Cache/Context/IsCurrentUserPageCacheContext.php, line 39

Class

IsCurrentUserPageCacheContext
Defines a cache context for whether the URL is the current user page.

Namespace

Drupal\opigno_dashboard\Cache\Context

Code

public function __construct(RouteMatchInterface $route_match, AccountInterface $account) {
  $this->uid = (int) $account
    ->id();
  $this->isUserPage = $route_match
    ->getRouteName() === 'entity.user.canonical' && (int) $route_match
    ->getRawParameter('user') === $this->uid;
}