You are here

FormRouteEnhancer.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php

File

core/lib/Drupal/Core/Routing/Enhancer/FormRouteEnhancer.php
View source
<?php

/**
 * @file
 * Contains \Drupal\Core\Routing\Enhancer\FormRouteEnhancer.
 */
namespace Drupal\Core\Routing\Enhancer;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Route;

/**
 * Enhancer to add a wrapping controller for _form routes.
 */
class FormRouteEnhancer implements RouteEnhancerInterface {

  /**
   * {@inheritdoc}
   */
  public function applies(Route $route) {
    return $route
      ->hasDefault('_form') && !$route
      ->hasDefault('_controller');
  }

  /**
   * {@inheritdoc}
   */
  public function enhance(array $defaults, Request $request) {
    $defaults['_controller'] = 'controller.form:getContentResult';
    return $defaults;
  }

}

Classes

Namesort descending Description
FormRouteEnhancer Enhancer to add a wrapping controller for _form routes.