function HandlerTest::viewsData

Same name in this branch
  1. 10 core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::viewsData()
Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/Handler/HandlerTest.php \Drupal\Tests\views\Functional\Handler\HandlerTest::viewsData()
  2. 9 core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::viewsData()
  3. 8.9.x core/modules/views/tests/src/Functional/Handler/HandlerTest.php \Drupal\Tests\views\Functional\Handler\HandlerTest::viewsData()
  4. 8.9.x core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::viewsData()
  5. 11.x core/modules/views/tests/src/Functional/Handler/HandlerTest.php \Drupal\Tests\views\Functional\Handler\HandlerTest::viewsData()
  6. 11.x core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::viewsData()

Overrides ViewTestBase::viewsData

1 call to HandlerTest::viewsData()
HandlerTest::testAccess in core/modules/views/tests/src/Functional/Handler/HandlerTest.php
Tests access to a handler.

File

core/modules/views/tests/src/Functional/Handler/HandlerTest.php, line 55

Class

HandlerTest
Tests abstract handler definitions.

Namespace

Drupal\Tests\views\Functional\Handler

Code

protected function viewsData() {
    $data = parent::viewsData();
    // Override the name handler to be able to call placeholder() from outside.
    $data['views_test_data']['name']['field']['id'] = 'test_field';
    // Setup one field with an access callback and one with an access callback
    // and arguments.
    $data['views_test_data']['access_callback'] = $data['views_test_data']['id'];
    $data['views_test_data']['access_callback_arguments'] = $data['views_test_data']['id'];
    foreach (ViewExecutable::getHandlerTypes() as $type => $info) {
        if (isset($data['views_test_data']['access_callback'][$type]['id'])) {
            $data['views_test_data']['access_callback'][$type]['access callback'] = 'views_test_data_handler_test_access_callback';
            $data['views_test_data']['access_callback_arguments'][$type]['access callback'] = 'views_test_data_handler_test_access_callback_argument';
            $data['views_test_data']['access_callback_arguments'][$type]['access arguments'] = [
                TRUE,
            ];
        }
    }
    return $data;
}

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