protected function RouteSubscriber::getEntityAutoSkuRoute in Commerce AutoSKU 8.2
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::getEntityAutoSkuRoute()
- RouteSubscriber::alterRoutes in src/
Routing/ RouteSubscriber.php - Alters existing routes for a specific collection.
File
- src/
Routing/ RouteSubscriber.php, line 59 - Contains \Drupal\commerce_autosku\Routing\RouteSubscriber.
Class
- RouteSubscriber
- Subscriber for commerce_autosku routes.
Namespace
Drupal\commerce_autosku\RoutingCode
protected function getEntityAutoSkuRoute(EntityTypeInterface $entity_type) {
if ($route_load = $entity_type
->getLinkTemplate('auto-sku')) {
$entity_type_id = $entity_type
->id();
$route = new Route($route_load);
$route
->addDefaults([
'_form' => '\\Drupal\\commerce_autosku\\Form\\CommerceAutoSkuForm',
'_title' => 'Automatic SKU',
])
->addRequirements([
'_permission' => 'administer ' . $entity_type_id . ' SKU',
])
->setOption('_admin_route', TRUE)
->setOption('parameters', [
$entity_type_id => [
'type' => 'entity:' . $entity_type_id,
],
]);
return $route;
}
}