protected static function Routes::addRouteParameter in JSON:API 8
Same name and namespace in other branches
- 8.2 src/Routing/Routes.php \Drupal\jsonapi\Routing\Routes::addRouteParameter()
Adds a parameter option to a route, overrides options of the same name.
The Symfony Route class only has a method for adding options which overrides any previous values. Therefore, it is tedious to add a single parameter while keeping those that are already set.
Parameters
\Symfony\Component\Routing\Route $route: The route to which the parameter is to be added.
string $name: The name of the parameter.
mixed $parameter: The parameter's options.
1 call to Routes::addRouteParameter()
- Routes::getRoutesForResourceType in src/
Routing/ Routes.php - Gets applicable resource routes for a JSON API resource type.
File
- src/
Routing/ Routes.php, line 238
Class
- Routes
- Defines dynamic routes.
Namespace
Drupal\jsonapi\RoutingCode
protected static function addRouteParameter(Route $route, $name, $parameter) {
$parameters = $route
->getOption('parameters') ?: [];
$parameters[$name] = $parameter;
$route
->setOption('parameters', $parameters);
}