class HtmlEntityFormController extends FormController (View source)

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

Traits

Provides dependency injection friendly methods for serialization.

Properties

protected array $_serviceIds

An array of service IDs keyed by property name used for serialization.

from  DependencySerializationTrait
protected array $_entityStorages

An array of entity type IDs keyed by the property name of their storages.

from  DependencySerializationTrait
protected ArgumentResolverInterface $argumentResolver

The argument resolver.

from  FormController
protected FormBuilderInterface $formBuilder

The form builder.

from  FormController
protected EntityTypeManagerInterface $entityTypeManager

The entity type manager service.

Methods

__sleep()

{@inheritdoc}

__wakeup()

{@inheritdoc}

__construct(ArgumentResolverInterface $argument_resolver, FormBuilderInterface $form_builder, EntityTypeManagerInterface $entity_type_manager)

Constructs a new \Drupal\Core\Routing\Enhancer\FormEnhancer object.

array
getContentResult(Request $request, RouteMatchInterface $route_match)

Invokes the form and returns the result.

string
getFormArgument(RouteMatchInterface $route_match)

Extracts the form argument string from a request.

getFormObject(RouteMatchInterface $route_match, string $form_arg)

Returns the object used to build the form.

Details

__sleep()

{@inheritdoc}

__wakeup()

{@inheritdoc}

__construct(ArgumentResolverInterface $argument_resolver, FormBuilderInterface $form_builder, EntityTypeManagerInterface $entity_type_manager)

Constructs a new \Drupal\Core\Routing\Enhancer\FormEnhancer object.

Parameters

ArgumentResolverInterface $argument_resolver

The argument resolver.

FormBuilderInterface $form_builder

The form builder.

EntityTypeManagerInterface $entity_type_manager

The entity type manager service.

array getContentResult(Request $request, RouteMatchInterface $route_match)

Invokes the form and returns the result.

Parameters

Request $request

The request object.

RouteMatchInterface $route_match

The route match.

Return Value

array

The render array that results from invoking the controller.

protected string getFormArgument(RouteMatchInterface $route_match)

Extracts the form argument string from a request.

Depending on the type of form the argument string may be stored in a different request attribute.

One example of a route definition is given below.

Parameters

RouteMatchInterface $route_match

The route match object from which to extract a form definition string.

Return Value

string

The form definition string.

protected FormInterface getFormObject(RouteMatchInterface $route_match, string $form_arg)

Returns the object used to build the form.

Parameters

RouteMatchInterface $route_match

The route match.

string $form_arg

Either a class name or a service ID.

Return Value

FormInterface

The form object to use.