You are here

public function RouteIsAdminCacheContext::getContext in Menu Per Role 8

Returns the string representation of the cache context.

A cache context service's name is used as a token (placeholder) cache key, and is then replaced with the string returned by this method.

Return value

string The string representation of the cache context.

Overrides CacheContextInterface::getContext

File

src/Cache/Context/RouteIsAdminCacheContext.php, line 52

Class

RouteIsAdminCacheContext
Defines a cache context depending if the route is an admin route or not.

Namespace

Drupal\menu_per_role\Cache\Context

Code

public function getContext() {
  return $this->adminContext
    ->isAdminRoute() ? '1' : '0';
}