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