protected function MenuTreeResource::getBaseRoute in REST Menu Tree 2.x
Same name and namespace in other branches
- 8 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\resourceCode
protected function getBaseRoute($canonical_path, $method) {
$route = parent::getBaseRoute($canonical_path, $method);
$parameters = $route
->getOption('parameters') ?: [];
$parameters['menu']['type'] = 'entity:menu';
$route
->setOption('parameters', $parameters);
return $route;
}