You are here

protected function ResourceBase::getBaseRoute in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/rest/src/Plugin/ResourceBase.php \Drupal\rest\Plugin\ResourceBase::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.

2 calls to ResourceBase::getBaseRoute()
EntityResource::getBaseRoute in core/modules/rest/src/Plugin/rest/resource/EntityResource.php
Setups the base route for all HTTP methods.
ResourceBase::routes in core/modules/rest/src/Plugin/ResourceBase.php
Returns a collection of routes with URL path information for the resource.
1 method overrides ResourceBase::getBaseRoute()
EntityResource::getBaseRoute in core/modules/rest/src/Plugin/rest/resource/EntityResource.php
Setups the base route for all HTTP methods.

File

core/modules/rest/src/Plugin/ResourceBase.php, line 197
Contains \Drupal\rest\Plugin\ResourceBase.

Class

ResourceBase
Common base class for resource plugins.

Namespace

Drupal\rest\Plugin

Code

protected function getBaseRoute($canonical_path, $method) {
  $lower_method = strtolower($method);
  $route = new Route($canonical_path, array(
    '_controller' => 'Drupal\\rest\\RequestHandler::handle',
    // Pass the resource plugin ID along as default property.
    '_plugin' => $this->pluginId,
  ), array(
    '_permission' => "restful {$lower_method} {$this->pluginId}",
  ), array(), '', array(), array(
    $method,
  ));
  return $route;
}