You are here

protected function MenuTreeResource::getBaseRoute in Colossal Menu 2.x

Same name and namespace in other branches
  1. 8 modules/colossal_menu_rest/src/Plugin/rest/resource/MenuTreeResource.php \Drupal\colossal_menu_rest\Plugin\rest\resource\MenuTreeResource::getBaseRoute()

Gets the base route for a particular method.

Parameters

string $canonical_path: The canonical path for the resource.

string $method: The HTTP method to be used for the route.

Return value

\Symfony\Component\Routing\Route The created base route.

Overrides MenuTreeResource::getBaseRoute

File

modules/colossal_menu_rest/src/Plugin/rest/resource/MenuTreeResource.php, line 39

Class

MenuTreeResource
Provides a resource to get view modes by entity and bundle.

Namespace

Drupal\colossal_menu_rest\Plugin\rest\resource

Code

protected function getBaseRoute($canonical_path, $method) {
  $route = parent::getBaseRoute($canonical_path, $method);
  $parameters = $route
    ->getOption('parameters') ?: [];
  $parameters['colossal_menu']['type'] = 'entity:colossal_menu';
  $route
    ->setOption('parameters', $parameters);
  return $route;
}