function ViewTestData::viewsData

Same name and namespace in other branches
  1. 9 core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::viewsData()
  2. 8.9.x core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::viewsData()
  3. 10 core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::viewsData()

Returns the views data definition.

5 calls to ViewTestData::viewsData()
PreviewTest::viewsData in core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
Returns the views data definition.
ViewsDataHelperTest::viewsData in core/modules/views/tests/src/Unit/ViewsDataHelperTest.php
Returns the views data definition.
ViewsDataTest::viewsData in core/modules/views/tests/src/Unit/ViewsDataTest.php
Returns the views data definition.
ViewsKernelTestBase::viewsData in core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php
Returns the views data definition.
ViewTestBase::viewsData in core/modules/views/tests/src/Functional/ViewTestBase.php
Returns the views data definition.

File

core/modules/views/src/Tests/ViewTestData.php, line 124

Class

ViewTestData
Provides tests view data and the base test schema with sample data records.

Namespace

Drupal\views\Tests

Code

public static function viewsData() {
    // Declaration of the base table.
    $data['views_test_data']['table'] = [
        'group' => 'Views test',
        'base' => [
            'field' => 'id',
            'title' => 'Views test data',
            'help' => 'Users who have created accounts on your site.',
        ],
    ];
    // Declaration of fields.
    $data['views_test_data']['id'] = [
        'title' => 'ID',
        'help' => 'The test data ID',
        'field' => [
            'id' => 'numeric',
        ],
        'argument' => [
            'id' => 'numeric',
        ],
        'filter' => [
            'id' => 'numeric',
        ],
        'sort' => [
            'id' => 'standard',
        ],
    ];
    $data['views_test_data']['name'] = [
        'title' => 'Name',
        'help' => 'The name of the person',
        'field' => [
            'id' => 'standard',
        ],
        'argument' => [
            'id' => 'string',
        ],
        'filter' => [
            'id' => 'string',
        ],
        'sort' => [
            'id' => 'standard',
        ],
    ];
    $data['views_test_data']['age'] = [
        'title' => 'Age',
        'help' => 'The age of the person',
        'field' => [
            'id' => 'numeric',
        ],
        'argument' => [
            'id' => 'numeric',
        ],
        'filter' => [
            'id' => 'numeric',
        ],
        'sort' => [
            'id' => 'standard',
        ],
    ];
    $data['views_test_data']['job'] = [
        'title' => 'Job',
        'help' => 'The job of the person',
        'field' => [
            'id' => 'standard',
        ],
        'argument' => [
            'id' => 'string',
        ],
        'filter' => [
            'id' => 'string',
        ],
        'sort' => [
            'id' => 'standard',
        ],
    ];
    $data['views_test_data']['created'] = [
        'title' => 'Created',
        'help' => 'The creation date of this record',
        'field' => [
            'id' => 'date',
        ],
        'argument' => [
            'id' => 'date',
        ],
        'filter' => [
            'id' => 'date',
        ],
        'sort' => [
            'id' => 'date',
        ],
    ];
    $data['views_test_data']['status'] = [
        'title' => 'Status',
        'help' => 'The status of this record',
        'field' => [
            'id' => 'boolean',
        ],
        'filter' => [
            'id' => 'boolean',
        ],
        'sort' => [
            'id' => 'standard',
        ],
    ];
    return $data;
}

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