You are here

protected function MyCache::getCacheId in Visually Impaired Support (module) 8

Gets the page cache ID for this request.

Parameters

\Symfony\Component\HttpFoundation\Request $request: A request object.

Return value

string The cache ID for this request.

Overrides PageCache::getCacheId

File

src/StackMiddleware/MyCache.php, line 22

Class

MyCache
Extending PageCache.

Namespace

Drupal\visually_impaired_module\StackMiddleware

Code

protected function getCacheId(Request $request) {
  $cookie = '';
  if (isset($_COOKIE['visually_impaired'])) {
    $cookie = $_COOKIE['visually_impaired'];
  }
  $cid_parts = [
    $cookie,
    $request
      ->getSchemeAndHttpHost() . $request
      ->getRequestUri(),
    $request
      ->getRequestFormat(),
  ];
  return implode(':', $cid_parts);
}