class CsvSubscriber in CSV Serialization 8
Same name and namespace in other branches
- 8.2 src/EventSubscriber/CsvSubscriber.php \Drupal\csv_serialization\EventSubscriber\CsvSubscriber
Event subscriber for adding CSV content types to the request.
Hierarchy
- class \Drupal\csv_serialization\EventSubscriber\CsvSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of CsvSubscriber
1 string reference to 'CsvSubscriber'
1 service uses CsvSubscriber
File
- src/
EventSubscriber/ CsvSubscriber.php, line 12
Namespace
Drupal\csv_serialization\EventSubscriberView source
class CsvSubscriber implements EventSubscriberInterface {
/**
* Register content type formats on the request object.
*
* @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
* The Event to process.
*/
public function onKernelRequest(GetResponseEvent $event) {
$event
->getRequest()
->setFormat('csv', [
'text/csv',
]);
}
/**
* Implements \Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents().
*/
public static function getSubscribedEvents() {
$events[KernelEvents::REQUEST][] = [
'onKernelRequest',
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CsvSubscriber:: |
public static | function | Implements \Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents(). | |
CsvSubscriber:: |
public | function | Register content type formats on the request object. |