protected function RouteSubscriber::getEntityLabelRoute in Automatic Entity Label 8.2
Same name and namespace in other branches
- 8.3 src/Routing/RouteSubscriber.php \Drupal\auto_entitylabel\Routing\RouteSubscriber::getEntityLabelRoute()
- 8 src/Routing/RouteSubscriber.php \Drupal\auto_entitylabel\Routing\RouteSubscriber::getEntityLabelRoute()
Gets the Entity Auto Label 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::getEntityLabelRoute()
- RouteSubscriber::alterRoutes in src/
Routing/ RouteSubscriber.php - Alters existing routes for a specific collection.
File
- src/
Routing/ RouteSubscriber.php, line 54
Class
- RouteSubscriber
- Subscriber for auto_entitylabel routes.
Namespace
Drupal\auto_entitylabel\RoutingCode
protected function getEntityLabelRoute(EntityTypeInterface $entity_type) {
if ($route_load = $entity_type
->getLinkTemplate('auto-label')) {
$entity_type_id = $entity_type
->id();
$route = new Route($route_load);
$route
->addDefaults([
'_form' => '\\Drupal\\auto_entitylabel\\Form\\AutoEntityLabelForm',
'_title' => 'Automatic entity label',
])
->addRequirements([
'_permission' => 'administer ' . $entity_type_id . ' labels',
])
->setOption('_admin_route', TRUE)
->setOption('parameters', [
$entity_type_id => [
'type' => 'entity:' . $entity_type_id,
],
]);
return $route;
}
}