function synonyms_views_filter_views_data in Synonyms 8
Same name and namespace in other branches
- 2.0.x modules/synonyms_views_filter/synonyms_views_filter.module \synonyms_views_filter_views_data()
Implements hook_views_data().
File
- synonyms_views_filter/
synonyms_views_filter.module, line 13 - Integrates Synonyms with core Views module.
Code
function synonyms_views_filter_views_data() {
$data = [];
foreach (\Drupal::entityTypeManager()
->getDefinitions() as $entity_type) {
if ($entity_type instanceof ContentEntityTypeInterface && $entity_type
->getBaseTable() && $entity_type
->getKey('id')) {
$data[$entity_type
->getBaseTable()]['synonyms'] = [
'title' => t('Synonyms of @entity_type', [
'@entity_type' => $entity_type
->getSingularLabel(),
]),
'filter' => [
'id' => 'synonyms_entity',
'real field' => $entity_type
->getKey('id'),
'entity_type' => $entity_type
->id(),
],
];
}
}
return $data;
}