function FormRouteEnhancer::enhance

Same name in other branches
  1. 9 core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php \Drupal\Core\Routing\Enhancer\FormRouteEnhancer::enhance()
  2. 8.9.x core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php \Drupal\Core\Routing\Enhancer\FormRouteEnhancer::enhance()
  3. 10 core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php \Drupal\Core\Routing\Enhancer\FormRouteEnhancer::enhance()

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.