You are here

public function PirateDayCacheContext::getContext in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config/tests/config_override_test/src/Cache/PirateDayCacheContext.php \Drupal\config_override_test\Cache\PirateDayCacheContext::getContext()

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

core/modules/config/tests/config_override_test/src/Cache/PirateDayCacheContext.php, line 41
Contains \Drupal\config_override_test\Cache\PirateDayCacheContext.

Class

PirateDayCacheContext
Defines the PirateDayCacheContext service that allows to cache the booty.

Namespace

Drupal\config_override_test\Cache

Code

public function getContext() {
  $is_pirate_day = static::isPirateDay() ? 'yarr' : 'nay';
  return "pirate_day." . $is_pirate_day;
}