public function MasqueradeCacheContext::getContext in Masquerade 8.2
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/ MasqueradeCacheContext.php, line 27
Class
- MasqueradeCacheContext
- Defines the MasqueradeCacheContext service, for "masquerade" caching.
Namespace
Drupal\masquerade\CacheCode
public function getContext() {
if ($request = $this->requestStack
->getCurrentRequest()) {
if ($request
->hasSession() && ($session = $request
->getSession())) {
if ($session
->has('masquerading')) {
// Previous account supposed to be Authenticated.
return '1';
}
}
}
return '0';
}