You are here

public function BackgroundImageSettingsFullViewportCacheContext::getContext in Background Image 2.0.x

Same name and namespace in other branches
  1. 8 src/Cache/Context/BackgroundImageSettingsFullViewportCacheContext.php \Drupal\background_image\Cache\Context\BackgroundImageSettingsFullViewportCacheContext::getContext()
  2. 2.x src/Cache/Context/BackgroundImageSettingsFullViewportCacheContext.php \Drupal\background_image\Cache\Context\BackgroundImageSettingsFullViewportCacheContext::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

src/Cache/Context/BackgroundImageSettingsFullViewportCacheContext.php, line 20

Class

BackgroundImageSettingsFullViewportCacheContext
Cache context ID: 'background_image.settings.full_viewport'.

Namespace

Drupal\background_image\Cache\Context

Code

public function getContext() {
  return $this->backgroundImage ? $this->backgroundImage
    ->getSetting('full_viewport') : 0;
}