function FormTestEventSubscriber::onKernelResponse
Same name in other branches
- 9 core/modules/system/tests/modules/form_test/src/EventSubscriber/FormTestEventSubscriber.php \Drupal\form_test\EventSubscriber\FormTestEventSubscriber::onKernelResponse()
- 8.9.x core/modules/system/tests/modules/form_test/src/EventSubscriber/FormTestEventSubscriber.php \Drupal\form_test\EventSubscriber\FormTestEventSubscriber::onKernelResponse()
- 10 core/modules/system/tests/modules/form_test/src/EventSubscriber/FormTestEventSubscriber.php \Drupal\form_test\EventSubscriber\FormTestEventSubscriber::onKernelResponse()
Adds custom headers to the response.
Parameters
\Symfony\Component\HttpKernel\Event\ResponseEvent $event: The kernel response event.
File
-
core/
modules/ system/ tests/ modules/ form_test/ src/ EventSubscriber/ FormTestEventSubscriber.php, line 35
Class
- FormTestEventSubscriber
- Test event subscriber to add new attributes to the request.
Namespace
Drupal\form_test\EventSubscriberCode
public function onKernelResponse(ResponseEvent $event) {
$response = $event->getResponse();
$response->headers
->set('X-Form-Test-Response-Event', 'invoked');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.