Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SessionExistsCacheContext.php

function SessionExistsCacheContext::getContext

Overrides CacheContextInterface::getContext

File

core/lib/Drupal/Core/Cache/Context/SessionExistsCacheContext.php, line 53

Class

SessionExistsCacheContext
Defines the SessionExistsCacheContext service, for "session or not" caching.

Namespace

Drupal\Core\Cache\Context

Code

public function getContext() {
    return $this->sessionConfiguration
        ->hasSession($this->requestStack
        ->getCurrentRequest()) ? '1' : '0';
}
RSS feed
Powered by Drupal