protected function RouteSubscriber::getPreviewList in View Modes Display 8.2
Gets the entity load route.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.
Return value
\Symfony\Component\Routing\Route|null The generated route, if available.
1 call to RouteSubscriber::getPreviewList()
- RouteSubscriber::alterRoutes in src/
Routing/ RouteSubscriber.php - Alters existing routes for a specific collection.
File
- src/
Routing/ RouteSubscriber.php, line 69
Class
- RouteSubscriber
- Subscriber for View Mode Display routes.
Namespace
Drupal\view_modes_display\RoutingCode
protected function getPreviewList(EntityTypeInterface $entity_type) {
if ($link_template = $entity_type
->getLinkTemplate('vmd-preview-list')) {
$entity_type_id = $entity_type
->id();
$route = new Route($link_template);
$route
->addDefaults([
'_controller' => '\\Drupal\\view_modes_display\\Controller\\PreviewController::previewList',
'_title' => 'Available View Mode Previews',
'entity_type' => $entity_type_id,
'view_mode' => 'all',
])
->addRequirements([
'_permission' => 'preview view modes',
])
->setOption('_admin_route', TRUE)
->setOption('parameters', [
$entity_type_id => [
'type' => 'entity:' . $entity_type_id,
],
]);
return $route;
}
}