You are here

public function Subscriber::onKernelRequest in Excel Serialization 8

Register content formats on the request object.

Parameters

Symfony\Component\HttpKernel\Event\RequestEvent $event: The event to get the request object to register on.

File

src/EventSubscriber/Subscriber.php, line 28

Class

Subscriber
Event subscriber for adding XLS content to the request.

Namespace

Drupal\xls_serialization\EventSubscriber

Code

public function onKernelRequest(RequestEvent $event) {
  $event
    ->getRequest()
    ->setFormat('xls', [
    'application/vnd.ms-excel',
  ]);
  $event
    ->getRequest()
    ->setFormat('xlsx', [
    'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  ]);
}