You are here

protected function MenuTreeResource::getBaseRoute in REST Menu Tree 8

Same name and namespace in other branches
  1. 2.x src/Plugin/rest/resource/MenuTreeResource.php \Drupal\rest_menu_tree\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 ResourceBase::getBaseRoute

File

src/Plugin/rest/resource/MenuTreeResource.php, line 274

Class

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

Namespace

Drupal\rest_menu_tree\Plugin\rest\resource

Code

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