You are here

public function FormRouteEnhancer::enhance in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php \Drupal\Core\Routing\Enhancer\FormRouteEnhancer::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\Enhancer

Code

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;
}