protected static function Routes::addRouteParameter in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/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.
2 calls to Routes::addRouteParameter()
- Routes::getFileUploadRoutesForResourceType in core/
modules/ jsonapi/ src/ Routing/ Routes.php - Gets the file upload route collection for the given resource type.
- Routes::getRoutesForResourceType in core/
modules/ jsonapi/ src/ Routing/ Routes.php - Gets applicable resource routes for a JSON:API resource type.
File
- core/
modules/ jsonapi/ src/ Routing/ Routes.php, line 387
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);
}