function RenderArrayNonHtmlSubscriber::getSubscribedEvents

Same name in other branches
  1. 9 core/lib/Drupal/Core/EventSubscriber/RenderArrayNonHtmlSubscriber.php \Drupal\Core\EventSubscriber\RenderArrayNonHtmlSubscriber::getSubscribedEvents()
  2. 8.9.x core/lib/Drupal/Core/EventSubscriber/RenderArrayNonHtmlSubscriber.php \Drupal\Core\EventSubscriber\RenderArrayNonHtmlSubscriber::getSubscribedEvents()
  3. 11.x core/lib/Drupal/Core/EventSubscriber/RenderArrayNonHtmlSubscriber.php \Drupal\Core\EventSubscriber\RenderArrayNonHtmlSubscriber::getSubscribedEvents()

File

core/lib/Drupal/Core/EventSubscriber/RenderArrayNonHtmlSubscriber.php, line 37

Class

RenderArrayNonHtmlSubscriber
Throws 406 if requesting non-HTML format and controller returns render array.

Namespace

Drupal\Core\EventSubscriber

Code

public static function getSubscribedEvents() : array {
    $events[KernelEvents::VIEW][] = [
        'onRespond',
        -10,
    ];
    return $events;
}

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