function IsFrontPathCacheContext::getCacheableMetadata

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Cache/Context/IsFrontPathCacheContext.php \Drupal\Core\Cache\Context\IsFrontPathCacheContext::getCacheableMetadata()
  2. 10 core/lib/Drupal/Core/Cache/Context/IsFrontPathCacheContext.php \Drupal\Core\Cache\Context\IsFrontPathCacheContext::getCacheableMetadata()
  3. 11.x core/lib/Drupal/Core/Cache/Context/IsFrontPathCacheContext.php \Drupal\Core\Cache\Context\IsFrontPathCacheContext::getCacheableMetadata()

Overrides CacheContextInterface::getCacheableMetadata

File

core/lib/Drupal/Core/Cache/Context/IsFrontPathCacheContext.php, line 47

Class

IsFrontPathCacheContext
Defines a cache context for whether the URL is the front page of the site.

Namespace

Drupal\Core\Cache\Context

Code

public function getCacheableMetadata() {
    $metadata = new CacheableMetadata();
    $metadata->addCacheTags([
        'config:system.site',
    ]);
    return $metadata;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.