Subscribes to the kernel request event to add the Ajax media type.
Expanded class hierarchy of AjaxSubscriber
class AjaxSubscriber implements EventSubscriberInterface {
/**
* Registers Ajax formats with the Request class.
*/
public function onKernelRequest(GetResponseEvent $event) {
$request = $event
->getRequest();
$request
->setFormat('drupal_ajax', 'application/vnd.drupal-ajax');
$request
->setFormat('drupal_dialog', 'application/vnd.drupal-dialog');
$request
->setFormat('drupal_modal', 'application/vnd.drupal-modal');
}
/**
* Registers the methods in this class that should be listeners.
*
* @return array
* An array of event listener definitions.
*/
static function getSubscribedEvents() {
$events[KernelEvents::REQUEST][] = array(
'onKernelRequest',
50,
);
return $events;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AjaxSubscriber:: |
static | function |
Registers the methods in this class that should be listeners. Overrides EventSubscriberInterface:: |
|
AjaxSubscriber:: |
public | function | Registers Ajax formats with the Request class. |