diff --git a/src/Access/LatestRevisionCheck.php b/src/Access/LatestRevisionCheck.php index 40ee81c..96908f5 100644 --- a/src/Access/LatestRevisionCheck.php +++ b/src/Access/LatestRevisionCheck.php @@ -1,6 +1,12 @@ moderationInfo->hasForwardRevision($this->loadEntity($route, $route_match)) - ? AccessResult::allowed() - : AccessResult::forbidden(); + $entity = $this->loadEntity($route, $route_match); + return $this->moderationInfo->hasForwardRevision($entity) + ? AccessResult::allowed()->addCacheableDependency($entity) + : AccessResult::forbidden()->addCacheableDependency($entity); } /** diff --git a/src/Plugin/Derivative/DynamicLocalTasks.php b/src/Plugin/Derivative/DynamicLocalTasks.php index d408edb..3493bbb 100644 --- a/src/Plugin/Derivative/DynamicLocalTasks.php +++ b/src/Plugin/Derivative/DynamicLocalTasks.php @@ -94,9 +94,9 @@ class DynamicLocalTasks extends DeriverBase implements ContainerDeriverInterface } /** - * Returns an array of content entities that are potentially moderatable. + * Returns an array of content entities that are potentially moderateable. * - * @return array + * @return EntityTypeInterface[] * An array of just those entities we care about. */ protected function moderatableEntityDefinitions() { @@ -109,7 +109,7 @@ class DynamicLocalTasks extends DeriverBase implements ContainerDeriverInterface /** * Returns an iterable of the config entities representing moderatable content. * - * @return array + * @return EntityTypeInterface[] * An array of just those entity types we care about. */ protected function moderatableEntityTypeDefinitions() { diff --git a/src/Routing/EntityModerationRouteProvider.php b/src/Routing/EntityModerationRouteProvider.php index c331cd4..c718228 100644 --- a/src/Routing/EntityModerationRouteProvider.php +++ b/src/Routing/EntityModerationRouteProvider.php @@ -5,10 +5,8 @@ * Contains Drupal\workbench_moderation\Routing\EntityModerationRouteProvider. */ - namespace Drupal\workbench_moderation\Routing; - use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityHandlerInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -18,6 +16,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; +/** + * Provides the following routes: + * + * - The latest version tab, showing the latest revision of an entity, not the + * default one. + */ class EntityModerationRouteProvider implements EntityRouteProviderInterface, EntityHandlerInterface { /**