class Routes in JSON:API Menu Items 1.0.x
Same name and namespace in other branches
- 1.2.x src/Routing/Routes.php \Drupal\jsonapi_menu_items\Routing\Routes
- 1.1.x src/Routing/Routes.php \Drupal\jsonapi_menu_items\Routing\Routes
Defines dynamic routes.
Each Menu will result in a jsonapi resource at: /{jsonapi_namespace}/menu_items/{menu_id}
Hierarchy
- class \Drupal\jsonapi_menu_items\Routing\Routes implements ContainerInjectionInterface
Expanded class hierarchy of Routes
File
- src/
Routing/ Routes.php, line 17
Namespace
Drupal\jsonapi_menu_items\RoutingView source
class Routes implements ContainerInjectionInterface {
const RESOURCE_NAME = MenuItemsResource::class;
const JSONAPI_RESOURCE_KEY = '_jsonapi_resource';
/**
* {@inheritdoc}
*/
public function __construct() {
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static();
}
/**
* {@inheritdoc}
*/
public function routes() {
$routes = new RouteCollection();
$route = new Route('/%jsonapi%/menu_items/{menu}');
$route
->addDefaults([
static::JSONAPI_RESOURCE_KEY => static::RESOURCE_NAME,
]);
$route
->setOption('parameters', [
'menu' => [
'type' => 'entity:menu',
],
]);
$routes
->add('jsonapi_menu_items.menu', $route);
$routes
->addRequirements([
'_access' => 'TRUE',
]);
return $routes;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Routes:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
Routes:: |
constant | |||
Routes:: |
constant | |||
Routes:: |
public | function | ||
Routes:: |
public | function |