EntityModerationRouteProvider::getRoutes

public EntityModerationRouteProvider::getRoutes(EntityTypeInterface $entity_type)

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

core/modules/content_moderation/src/Routing/EntityModerationRouteProvider.php, line 52

Class

EntityModerationRouteProvider
Dynamic route provider for the Content moderation module.

Namespace

Drupal\content_moderation\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;
}
doc_Drupal
2016-10-29 09:07:15
Comments
Leave a Comment

Please login to continue.