You are here

class HighContrastCacheContext in High contrast 8

Defines the HighContrastCacheContext service.

This allows caching of high and normal contrast versions of pages.

Hierarchy

Expanded class hierarchy of HighContrastCacheContext

1 string reference to 'HighContrastCacheContext'
high_contrast.services.yml in ./high_contrast.services.yml
high_contrast.services.yml
1 service uses HighContrastCacheContext
cache_context.high_contrast in ./high_contrast.services.yml
Drupal\high_contrast\Cache\Context\HighContrastCacheContext

File

src/Cache/Context/HighContrastCacheContext.php, line 14

Namespace

Drupal\high_contrast\Cache\Context
View source
class HighContrastCacheContext implements CacheContextInterface {

  /**
   * {@inheritdoc}
   */
  public static function getLabel() {
    return t('High contrast');
  }

  /**
   * {@inheritdoc}
   */
  public function getContext() {
    return HighContrastTrait::highContrastEnabled();
  }

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

}

Members

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