public function PreviewLinkRouteProvider::getRoutes in Preview Link 2.0.x
Same name and namespace in other branches
- 8 src/Routing/PreviewLinkRouteProvider.php \Drupal\preview_link\Routing\PreviewLinkRouteProvider::getRoutes()
- 2.x src/Routing/PreviewLinkRouteProvider.php \Drupal\preview_link\Routing\PreviewLinkRouteProvider::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/ PreviewLinkRouteProvider.php, line 20
Class
- PreviewLinkRouteProvider
- Preview Link route provider.
Namespace
Drupal\preview_link\RoutingCode
public function getRoutes(EntityTypeInterface $entity_type) {
$collection = new RouteCollection();
if ($route = $this
->getGeneratePreviewLinkRoute($entity_type)) {
$entity_type_id = $entity_type
->id();
$collection
->add("entity.{$entity_type_id}.preview_link_generate", $route);
}
if ($route = $this
->getPreviewLinkRoute($entity_type)) {
$entity_type_id = $entity_type
->id();
$collection
->add("entity.{$entity_type_id}.preview_link", $route);
}
return $collection;
}