function TimeZoneCacheContext::getContext

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

Overrides CacheContextInterface::getContext

File

core/lib/Drupal/Core/Cache/Context/TimeZoneCacheContext.php, line 26

Class

TimeZoneCacheContext
Defines the TimeZoneCacheContext service, for "per time zone" caching.

Namespace

Drupal\Core\Cache\Context

Code

public function getContext() {
    // date_default_timezone_set() is called in AccountProxy::setAccount(), so
    // we can safely retrieve the timezone.
    return date_default_timezone_get();
}

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