You are here

class EntityTestViewGrantsCacheContext in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php \Drupal\entity_test\Cache\EntityTestViewGrantsCacheContext
  2. 10 core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php \Drupal\entity_test\Cache\EntityTestViewGrantsCacheContext

Defines the entity_test view grants cache context service.

Cache context ID: 'entity_test_view_grants'.

Hierarchy

Expanded class hierarchy of EntityTestViewGrantsCacheContext

See also

\Drupal\node\Cache\NodeAccessViewGrantsCacheContext

1 string reference to 'EntityTestViewGrantsCacheContext'
entity_test.services.yml in core/modules/system/tests/modules/entity_test/entity_test.services.yml
core/modules/system/tests/modules/entity_test/entity_test.services.yml
1 service uses EntityTestViewGrantsCacheContext
cache_context.entity_test_view_grants in core/modules/system/tests/modules/entity_test/entity_test.services.yml
Drupal\entity_test\Cache\EntityTestViewGrantsCacheContext

File

core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php, line 15

Namespace

Drupal\entity_test\Cache
View source
class EntityTestViewGrantsCacheContext implements CacheContextInterface {

  /**
   * {@inheritdoc}
   */
  public static function getLabel() {
    return t("Entity test view grants");
  }

  /**
   * {@inheritdoc}
   */
  public function getContext() {

    // Return a constant value, so we can fetch render cache both in actual
    // requests and test code itself.
    return '299792458';
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheableMetadata() {
    return new CacheableMetadata();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityTestViewGrantsCacheContext::getCacheableMetadata public function Gets the cacheability metadata for the context. Overrides CacheContextInterface::getCacheableMetadata
EntityTestViewGrantsCacheContext::getContext public function Returns the string representation of the cache context. Overrides CacheContextInterface::getContext
EntityTestViewGrantsCacheContext::getLabel public static function Returns the label of the cache context. Overrides CacheContextInterface::getLabel