You are here

public function AjaxResponseSubscriber::onRequest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php \Drupal\Core\EventSubscriber\AjaxResponseSubscriber::onRequest()

Sets the AJAX parameter from the current request.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The response event, which contains the current request.

File

core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php, line 51
Contains \Drupal\Core\EventSubscriber\AjaxResponseSubscriber.

Class

AjaxResponseSubscriber
Response subscriber to handle AJAX responses.

Namespace

Drupal\Core\EventSubscriber

Code

public function onRequest(GetResponseEvent $event) {

  // Pass to the Html class that the current request is an Ajax request.
  if ($event
    ->getRequest()->request
    ->get(static::AJAX_REQUEST_PARAMETER)) {
    Html::setIsAjax(TRUE);
  }
}