function EntityTestViewsData::getViewsData
Same name in other branches
- 8.9.x core/modules/system/tests/modules/entity_test/src/EntityTestViewsData.php \Drupal\entity_test\EntityTestViewsData::getViewsData()
- 10 core/modules/system/tests/modules/entity_test/src/EntityTestViewsData.php \Drupal\entity_test\EntityTestViewsData::getViewsData()
- 11.x core/modules/system/tests/modules/entity_test/src/EntityTestViewsData.php \Drupal\entity_test\EntityTestViewsData::getViewsData()
Overrides EntityViewsData::getViewsData
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ EntityTestViewsData.php, line 16
Class
- EntityTestViewsData
- Provides a view to override views data for test entity types.
Namespace
Drupal\entity_testCode
public function getViewsData() {
$views_data = parent::getViewsData();
if ($this->entityType
->id() === 'entity_test_computed_field') {
$views_data['entity_test_computed_field']['computed_string_field'] = [
'title' => $this->t('Computed String Field'),
'field' => [
'id' => 'field',
'default_formatter' => 'string',
'field_name' => 'computed_string_field',
],
];
}
if ($this->entityType
->id() != 'entity_test') {
return $views_data;
}
$views_data = NestedArray::mergeDeep($views_data, \Drupal::state()->get('entity_test.views_data', []));
return $views_data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.