protected function Routes::createRoute in Schemata 8
Creates a route for a entity type and bundle.
Parameters
string $entity_type_id: The entity type id.
string $bundle: The bundle name.
Return value
\Symfony\Component\Routing\Route The route.
1 call to Routes::createRoute()
- Routes::routes in src/
Routing/ Routes.php - The route generator.
File
- src/
Routing/ Routes.php, line 101
Class
- Routes
- Class Routes.
Namespace
Drupal\schemata\RoutingCode
protected function createRoute($entity_type_id, $bundle = NULL) {
$path = $this
->getRoutePath($entity_type_id, $bundle);
$route = new Route($path);
$route
->setRequirement('_permission', 'access schemata data models');
$route
->setMethods([
'GET',
]);
$defaults = [
'entity_type_id' => $entity_type_id,
RouteObjectInterface::CONTROLLER_NAME => static::CONTROLLER,
];
if ($bundle) {
$defaults['bundle'] = $bundle;
}
$route
->setDefaults($defaults);
return $route;
}