You are here

class HtmlFormController in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Controller/HtmlFormController.php \Drupal\Core\Controller\HtmlFormController

Wrapping controller for forms that serve as the main page body.

Hierarchy

Expanded class hierarchy of HtmlFormController

1 file declares its use of HtmlFormController
FormControllerTest.php in core/tests/Drupal/Tests/Core/Controller/FormControllerTest.php
1 string reference to 'HtmlFormController'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses HtmlFormController
controller.form in core/core.services.yml
Drupal\Core\Controller\HtmlFormController

File

core/lib/Drupal/Core/Controller/HtmlFormController.php, line 13

Namespace

Drupal\Core\Controller
View source
class HtmlFormController extends FormController {

  /**
   * The class resolver.
   *
   * @var \Drupal\Core\DependencyInjection\ClassResolverInterface
   */
  protected $classResolver;

  /**
   * Constructs a new \Drupal\Core\Routing\Enhancer\FormEnhancer object.
   *
   * @param \Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface $argument_resolver
   *   The argument resolver.
   * @param \Drupal\Core\Form\FormBuilderInterface $form_builder
   *   The form builder.
   * @param \Drupal\Core\DependencyInjection\ClassResolverInterface $class_resolver
   *   The class resolver.
   */
  public function __construct(ArgumentResolverInterface $argument_resolver, FormBuilderInterface $form_builder, ClassResolverInterface $class_resolver) {
    parent::__construct($argument_resolver, $form_builder);
    $this->classResolver = $class_resolver;
  }

  /**
   * {@inheritdoc}
   */
  protected function getFormArgument(RouteMatchInterface $route_match) {
    return $route_match
      ->getRouteObject()
      ->getDefault('_form');
  }

  /**
   * {@inheritdoc}
   */
  protected function getFormObject(RouteMatchInterface $route_match, $form_arg) {
    return $this->classResolver
      ->getInstanceFromDefinition($form_arg);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
FormController::$argumentResolver protected property The argument resolver.
FormController::$controllerResolver Deprecated protected property The controller resolver.
FormController::$formBuilder protected property The form builder.
FormController::getContentResult public function Invokes the form and returns the result.
HtmlFormController::$classResolver protected property The class resolver.
HtmlFormController::getFormArgument protected function Extracts the form argument string from a request. Overrides FormController::getFormArgument
HtmlFormController::getFormObject protected function Returns the object used to build the form. Overrides FormController::getFormObject
HtmlFormController::__construct public function Constructs a new \Drupal\Core\Routing\Enhancer\FormEnhancer object. Overrides FormController::__construct