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
1 2 3 4 5 6 7 8 9 10 11 12 | 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.