You are here

private function CacheflushApi::redirectUrl in CacheFlush 8

Generate redirect URL.

@global string $base_url

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Redirect path.

2 calls to CacheflushApi::redirectUrl()
CacheflushApi::clearAll in src/Controller/CacheflushApi.php
Clear all caches.
CacheflushApi::clearById in src/Controller/CacheflushApi.php
Clear cache preset by cacheflush entity id.

File

src/Controller/CacheflushApi.php, line 272

Class

CacheflushApi
Returns responses for Cacheflush routes.

Namespace

Drupal\cacheflush\Controller

Code

private function redirectUrl() {
  global $base_url;
  $path = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL;
  if (empty($_SERVER['HTTP_REFERER'])) {
    $path = $base_url;
  }
  return new RedirectResponse($path);
}