protected function EntityResource::getBaseRoute in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/rest/src/Plugin/rest/resource/EntityResource.php \Drupal\rest\Plugin\rest\resource\EntityResource::getBaseRoute()
Setups the base route for all HTTP methods.
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
- core/
modules/ rest/ src/ Plugin/ rest/ resource/ EntityResource.php, line 235 - Contains \Drupal\rest\Plugin\rest\resource\EntityResource.
Class
- EntityResource
- Represents entities as resources.
Namespace
Drupal\rest\Plugin\rest\resourceCode
protected function getBaseRoute($canonical_path, $method) {
$route = parent::getBaseRoute($canonical_path, $method);
$definition = $this
->getPluginDefinition();
$parameters = $route
->getOption('parameters') ?: array();
$parameters[$definition['entity_type']]['type'] = 'entity:' . $definition['entity_type'];
$route
->setOption('parameters', $parameters);
return $route;
}