function AjaxResponseSubscriber::onRequest

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php \Drupal\Core\EventSubscriber\AjaxResponseSubscriber::onRequest()
  2. 8.9.x core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php \Drupal\Core\EventSubscriber\AjaxResponseSubscriber::onRequest()
  3. 11.x 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\RequestEvent $event: The response event, which contains the current request.

File

core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php, line 46

Class

AjaxResponseSubscriber
Response subscriber to handle AJAX responses.

Namespace

Drupal\Core\EventSubscriber

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.