public function AccessSchemeRouteProvider::getRoutes in Workbench Access 8
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 DefaultHtmlRouteProvider::getRoutes
File
- src/
Routing/ AccessSchemeRouteProvider.php, line 18
Class
- AccessSchemeRouteProvider
- Defines a route provider for access schemes.
Namespace
Drupal\workbench_access\RoutingCode
public function getRoutes(EntityTypeInterface $entity_type) {
$routes = parent::getRoutes($entity_type);
if ($entity_type
->hasLinkTemplate('sections')) {
$route = new Route($entity_type
->getLinkTemplate('sections'));
$route
->setDefault('_controller', WorkbenchAccessSections::class . '::page');
$route
->setDefault('_title', 'Sections');
$route
->setRequirement('_permission', 'assign workbench access');
$route
->setOption('parameters', [
'access_scheme' => [
'type' => 'entity:access_scheme',
],
]);
$routes
->add('entity.access_scheme.sections', $route);
}
return $routes;
}