public ViewsData::alterViewsData(array &$data)
Alters the table and field information from hook_views_data().
Parameters
array $data: An array of all information about Views tables and fields, collected from hook_views_data(), passed by reference.
See also
File
- core/modules/content_moderation/src/ViewsData.php, line 240
Class
- ViewsData
- Provides the content_moderation views integration.
Namespace
Drupal\content_moderation
Code
public function alterViewsData(array &$data) {
$entity_types_with_moderation = array_filter($this->entityTypeManager->getDefinitions(), function(EntityTypeInterface $type) {
return $this->moderationInformation->canModerateEntitiesOfEntityType($type);
});
foreach ($entity_types_with_moderation as $type) {
$data[$type->getRevisionTable()]['latest_revision'] = [
'title' => t('Is Latest Revision'),
'help' => t('Restrict the view to only revisions that are the latest revision of their entity.'),
'filter' => ['id' => 'latest_revision'],
];
}
}
Please login to continue.