You are here

public function EntityModerationRouteProvider::getRoutes in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/src/Entity/Routing/EntityModerationRouteProvider.php \Drupal\content_moderation\Entity\Routing\EntityModerationRouteProvider::getRoutes()
  2. 9 core/modules/content_moderation/src/Entity/Routing/EntityModerationRouteProvider.php \Drupal\content_moderation\Entity\Routing\EntityModerationRouteProvider::getRoutes()

File

core/modules/content_moderation/src/Entity/Routing/EntityModerationRouteProvider.php, line 54

Class

EntityModerationRouteProvider
Dynamic route provider for the Content moderation module.

Namespace

Drupal\content_moderation\Entity\Routing

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $collection = new RouteCollection();
  if ($moderation_route = $this
    ->getLatestVersionRoute($entity_type)) {
    $entity_type_id = $entity_type
      ->id();
    $collection
      ->add("entity.{$entity_type_id}.latest_version", $moderation_route);
  }
  return $collection;
}