You are here

public function EntityTypeModerationRouteProvider::getRoutes in Workbench Moderation 8.2

Same name and namespace in other branches
  1. 8 src/Routing/EntityTypeModerationRouteProvider.php \Drupal\workbench_moderation\Routing\EntityTypeModerationRouteProvider::getRoutes()

Provides routes for entities.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type

Return value

\Symfony\Component\Routing\RouteCollection|\Symfony\Component\Routing\Route[] Returns a route collection or an array of routes keyed by name, like route_callbacks inside 'routing.yml' files.

Overrides EntityRouteProviderInterface::getRoutes

File

src/Routing/EntityTypeModerationRouteProvider.php, line 18

Class

EntityTypeModerationRouteProvider
Provides the moderation configuration routes for config entities.

Namespace

Drupal\workbench_moderation\Routing

Code

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