function rest_test_views_views_post_execute in Drupal 9
Same name and namespace in other branches
- 8 core/modules/rest/tests/modules/rest_test_views/rest_test_views.module \rest_test_views_views_post_execute()
Implements hook_views_post_execute().
File
- core/
modules/ rest/ tests/ modules/ rest_test_views/ rest_test_views.module, line 13 - Test hook implementations for the REST views test module.
Code
function rest_test_views_views_post_execute(ViewExecutable $view) {
// Attach a custom header to the test_data_export view.
if ($view
->id() === 'test_serializer_display_entity') {
if ($value = \Drupal::state()
->get('rest_test_views_set_header', FALSE)) {
$view
->getResponse()->headers
->set('Custom-Header', $value);
}
}
}