You are here

protected function ResourceBase::getBaseRoute in Drupal 10

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

1 call to ResourceBase::getBaseRoute()
ResourceBase::routes in core/modules/rest/src/Plugin/ResourceBase.php
Returns a collection of routes with URL path information for the resource.
2 methods override ResourceBase::getBaseRoute()
EntityResource::getBaseRoute in core/modules/rest/src/Plugin/rest/resource/EntityResource.php
Gets the base route for a particular method.
FileUploadResource::getBaseRoute in core/modules/file/src/Plugin/rest/resource/FileUploadResource.php
Gets the base route for a particular method.

File

core/modules/rest/src/Plugin/ResourceBase.php, line 171

Class

ResourceBase
Common base class for resource plugins.

Namespace

Drupal\rest\Plugin

Code

protected function getBaseRoute($canonical_path, $method) {
  return new Route($canonical_path, [
    '_controller' => 'Drupal\\rest\\RequestHandler::handle',
  ], $this
    ->getBaseRouteRequirements($method), [], '', [], [
    $method,
  ]);
}