public function Js::checkForRedirection in JS Callback Handler 8.3
Checks the result from a callback to determine if it's redirection.
Parameters
mixed $result: The result from the callback.
Return value
\Drupal\js\Ajax\JsRedirectCommand|null Returns redirection command or NULL if not a redirection.
1 call to Js::checkForRedirection()
- Js::deliver in src/
Js.php - Sends content to the browser via the delivery callback.
File
- src/
Js.php, line 153
Class
- Js
- JS Callback Handler service.
Namespace
Drupal\jsCode
public function checkForRedirection($result = NULL) {
$redirection = NULL;
if ($this
->isExecuting() && $result instanceof RedirectResponse && $result
->isRedirect()) {
$this
->getResponse()
->setStatusCode($result
->getStatusCode());
$redirection = new JsRedirectCommand($result
->getTargetUrl(), $result instanceof JsRedirectResponse && $result
->isForced());
}
return $redirection;
}