function views_test_data_views_data

Same name in other branches
  1. 9 core/modules/views/tests/modules/views_test_data/views_test_data.views.inc \views_test_data_views_data()
  2. 10 core/modules/views/tests/modules/views_test_data/views_test_data.views.inc \views_test_data_views_data()
  3. 11.x core/modules/views/tests/modules/views_test_data/views_test_data.views.inc \views_test_data_views_data()

Implements hook_views_data().

5 string references to 'views_test_data_views_data'
PreviewTest::enableViewsTestModule in core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
Sets up the views_test_data.module.
ViewKernelTestBase::setUpFixtures in core/modules/views/src/Tests/ViewKernelTestBase.php
Sets up the configuration and schema of views and views_test_data modules.
ViewsKernelTestBase::setUpFixtures in core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php
Sets up the configuration and schema of views and views_test_data modules.
ViewTestBase::enableViewsTestModule in core/modules/views/src/Tests/ViewTestBase.php
Sets up the views_test_data.module.
ViewTestBase::enableViewsTestModule in core/modules/views/tests/src/Functional/ViewTestBase.php
Sets up the views_test_data.module.

File

core/modules/views/tests/modules/views_test_data/views_test_data.views.inc, line 14

Code

function views_test_data_views_data() {
    $state = \Drupal::service('state');
    $state->set('views_hook_test_views_data', TRUE);
    // We use a state variable to keep track of how many times this function is
    // called so we can assert that calls to
    // \Drupal\views\ViewsData::delete() trigger a rebuild of views data.
    if (!($count = $state->get('views_test_data_views_data_count'))) {
        $count = 0;
    }
    $count++;
    $state->set('views_test_data_views_data_count', $count);
    return $state->get('views_test_data_views_data', []);
}

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