public function HalSubscriber::onKernelRequest

Registers HAL formats with the Request class.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The event to process.

File

drupal/core/modules/hal/lib/Drupal/hal/HalSubscriber.php, line 25
Contains \Drupal\hal\HalSubscriber.

Class

HalSubscriber
Subscribes to the kernel request event to add HAL media types.

Namespace

Drupal\hal

Code

public function onKernelRequest(GetResponseEvent $event) {
  $request = $event
    ->getRequest();
  $request
    ->setFormat('hal_json', 'application/hal+json');
}