You are here

public function ConfigOverrideIntegrationTestCacheContext::getContext in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/config/tests/config_override_integration_test/src/Cache/ConfigOverrideIntegrationTestCacheContext.php \Drupal\config_override_integration_test\Cache\ConfigOverrideIntegrationTestCacheContext::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_integration_test/src/Cache/ConfigOverrideIntegrationTestCacheContext.php, line 25

Class

ConfigOverrideIntegrationTestCacheContext
A cache context service intended for the config override integration test.

Namespace

Drupal\config_override_integration_test\Cache

Code

public function getContext() {

  // Default to the 'disabled' state.
  $state = \Drupal::state()
    ->get('config_override_integration_test.enabled', FALSE) ? 'yes' : 'no';
  return 'config_override_integration_test.' . $state;
}