public static function ViewTestData::viewsData

Returns the views data definition.

2 calls to ViewTestData::viewsData()
ViewTestBase::viewsData in drupal/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php
Returns the views data definition.
ViewUnitTestBase::viewsData in drupal/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php
Returns the views data definition.

File

drupal/core/modules/views/lib/Drupal/views/Tests/ViewTestData.php, line 120
Contains \Drupal\views\Tests\ViewTestData.

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'] = array(
    'group' => t('Views test'),
    'base' => array(
      'field' => 'id',
      'title' => t('Views test data'),
      'help' => t('Users who have created accounts on your site.'),
    ),
  );

  // Declaration of fields.
  $data['views_test_data']['id'] = array(
    'title' => t('ID'),
    'help' => t('The test data ID'),
    'field' => array(
      'id' => 'numeric',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'id' => 'numeric',
    ),
    'filter' => array(
      'id' => 'numeric',
    ),
    'sort' => array(
      'id' => 'standard',
    ),
  );
  $data['views_test_data']['name'] = array(
    'title' => t('Name'),
    'help' => t('The name of the person'),
    'field' => array(
      'id' => 'standard',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'id' => 'string',
    ),
    'filter' => array(
      'id' => 'string',
    ),
    'sort' => array(
      'id' => 'standard',
    ),
  );
  $data['views_test_data']['age'] = array(
    'title' => t('Age'),
    'help' => t('The age of the person'),
    'field' => array(
      'id' => 'numeric',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'id' => 'numeric',
    ),
    'filter' => array(
      'id' => 'numeric',
    ),
    'sort' => array(
      'id' => 'standard',
    ),
  );
  $data['views_test_data']['job'] = array(
    'title' => t('Job'),
    'help' => t('The job of the person'),
    'field' => array(
      'id' => 'standard',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'id' => 'string',
    ),
    'filter' => array(
      'id' => 'string',
    ),
    'sort' => array(
      'id' => 'standard',
    ),
  );
  $data['views_test_data']['created'] = array(
    'title' => t('Created'),
    'help' => t('The creation date of this record'),
    'field' => array(
      'id' => 'date',
      'click sortable' => TRUE,
    ),
    'argument' => array(
      'id' => 'date',
    ),
    'filter' => array(
      'id' => 'date',
    ),
    'sort' => array(
      'id' => 'date',
    ),
  );
  return $data;
}