rest_test_views.module

Same filename in other branches
  1. 9 core/modules/rest/tests/modules/rest_test_views/rest_test_views.module
  2. 8.9.x core/modules/rest/tests/modules/rest_test_views/rest_test_views.module
  3. 10 core/modules/rest/tests/modules/rest_test_views/rest_test_views.module

File

core/modules/rest/tests/modules/rest_test_views/rest_test_views.module

View source
<?php


/**
 * @file
 * Test hook implementations for the REST views test module.
 */
declare (strict_types=1);
use Drupal\views\ViewExecutable;

/**
 * Implements hook_views_post_execute().
 */
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);
        }
    }
}

Functions

Title Deprecated Summary
rest_test_views_views_post_execute Implements hook_views_post_execute().

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