You are here

public function Routes::routes in JSON:API Menu Items 1.0.x

Same name and namespace in other branches
  1. 1.2.x src/Routing/Routes.php \Drupal\jsonapi_menu_items\Routing\Routes::routes()
  2. 1.1.x src/Routing/Routes.php \Drupal\jsonapi_menu_items\Routing\Routes::routes()
1 string reference to 'Routes::routes'
jsonapi_menu_items.routing.yml in ./jsonapi_menu_items.routing.yml
jsonapi_menu_items.routing.yml

File

src/Routing/Routes.php, line 36

Class

Routes
Defines dynamic routes.

Namespace

Drupal\jsonapi_menu_items\Routing

Code

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;
}