X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews%2Fsrc%2FEntityViewsData.php;h=59e9196ff9e157926c154e66f08f24dd7867ed8d;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=2ba2086ac10397f529244f4a0afdd50683f71725;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/views/src/EntityViewsData.php b/web/core/modules/views/src/EntityViewsData.php index 2ba2086ac..59e9196ff 100644 --- a/web/core/modules/views/src/EntityViewsData.php +++ b/web/core/modules/views/src/EntityViewsData.php @@ -236,6 +236,13 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac 'type' => 'INNER', ]; } + + // Add a filter for showing only the latest revisions of an entity. + $data[$revision_table]['latest_revision'] = [ + 'title' => $this->t('Is Latest Revision'), + 'help' => $this->t('Restrict the view to only revisions that are the latest revision of their entity.'), + 'filter' => ['id' => 'latest_revision'], + ]; } $this->addEntityLinks($data[$base_table]); @@ -300,7 +307,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac // Add the entity type key to each table generated. $entity_type_id = $this->entityType->id(); - array_walk($data, function(&$table_data) use ($entity_type_id){ + array_walk($data, function (&$table_data) use ($entity_type_id) { $table_data['table']['entity type'] = $entity_type_id; });