function IsFrontPathCacheContext::getCacheableMetadata

Same name and namespace in other branches
  1. 11.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. 8.9.x core/lib/Drupal/Core/Cache/Context/IsFrontPathCacheContext.php \Drupal\Core\Cache\Context\IsFrontPathCacheContext::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.