function synonyms_views_data in Synonyms 2.0.x
Same name and namespace in other branches
- 7 views/synonyms.views.inc \synonyms_views_data()
Implements hook_views_data().
File
- modules/
synonyms_views_field/ synonyms_views_field.module, line 11 - Integrates synonyms field with core Views module.
Code
function synonyms_views_data() {
$data = [];
foreach (\Drupal::entityTypeManager()
->getDefinitions() as $entity_type) {
$tables = [
$entity_type
->getDataTable() ?? $entity_type
->getBaseTable(),
$entity_type
->getRevisionDataTable() ?? $entity_type
->getRevisionTable(),
];
$tables = array_filter($tables);
foreach ($tables as $table) {
$data[$table]['synonyms'] = [
'title' => t('Synonyms list'),
'help' => t('A list of entity synonyms.'),
'field' => [
'id' => 'field',
'field_name' => 'synonyms',
],
];
}
}
return $data;
}