You are here

public function CountryCacheContext::getContext in Price 8

Same name and namespace in other branches
  1. 3.x src/Cache/Context/CountryCacheContext.php \Drupal\price\Cache\Context\CountryCacheContext::getContext()
  2. 2.0.x src/Cache/Context/CountryCacheContext.php \Drupal\price\Cache\Context\CountryCacheContext::getContext()
  3. 2.x src/Cache/Context/CountryCacheContext.php \Drupal\price\Cache\Context\CountryCacheContext::getContext()
  4. 3.0.x src/Cache/Context/CountryCacheContext.php \Drupal\price\Cache\Context\CountryCacheContext::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/CountryCacheContext.php, line 43

Class

CountryCacheContext
Defines the country cache context, for "per country" caching.

Namespace

Drupal\price\Cache\Context

Code

public function getContext() {
  return $this->currentCountry
    ->getCountry()
    ->getCountryCode();
}