public function FormRouteEnhancer::enhance in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php \Drupal\Core\Routing\Enhancer\FormRouteEnhancer::enhance()
- 9 core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php \Drupal\Core\Routing\Enhancer\FormRouteEnhancer::enhance()
Updates the defaults for a route definition based on the request.
Parameters
array $defaults: The defaults, maps to '_defaults' in the route definition YAML.
\Symfony\Component\HttpFoundation\Request $request: The Request instance.
Return value
array The modified defaults. Each enhancer MUST return the $defaults but may add or remove values.
Overrides EnhancerInterface::enhance
File
- core/
lib/ Drupal/ Core/ Routing/ Enhancer/ FormRouteEnhancer.php, line 30
Class
- FormRouteEnhancer
- Enhancer to add a wrapping controller for _form routes.
Namespace
Drupal\Core\Routing\EnhancerCode
public function enhance(array $defaults, Request $request) {
$route = $defaults[RouteObjectInterface::ROUTE_OBJECT];
if (!$this
->applies($route)) {
return $defaults;
}
$defaults['_controller'] = 'controller.form:getContentResult';
return $defaults;
}