ViewsForm
class ViewsForm implements FormInterface, ContainerInjectionInterface (View source)
Provides a base class for single- or multistep view forms.
This class only dispatches logic to the form for the current step. The form is always assumed to be multistep, even if it has only one step (which by default is \Drupal\views\Form\ViewsFormMainForm). That way it is actually possible for modules to have a multistep form if they need to.
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 ClassResolverInterface | $classResolver | The class resolver to get the subform form objects. |
|
| protected RequestStack | $requestStack | The request stack. |
|
| protected UrlGeneratorInterface | $urlGenerator | The url generator to generate the form action. |
|
| protected string | $viewId | The ID of the view. |
|
| protected string | $viewDisplayId | The ID of the active view's display. |
|
| protected string[] | $viewArguments | The arguments passed to the active view. |
Methods
Constructs a ViewsForm object.
Instantiates a new instance of this class.
Returns a string for the form's base ID.
Returns a unique string identifying the form.
Form constructor.
Details
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}
__construct(ClassResolverInterface $class_resolver, UrlGeneratorInterface $url_generator, RequestStack $requestStack, string $view_id, string $view_display_id, array $view_args)
Constructs a ViewsForm object.
static
create(ContainerInterface $container, $view_id = NULL, $view_display_id = NULL, array $view_args = NULL)
Instantiates a new instance of this class.
This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.
string
getBaseFormId()
Returns a string for the form's base ID.
string
getFormId()
Returns a unique string identifying the form.
The returned ID should be a unique string that can be a valid PHP function name, since it's used in hook implementation names such as hook_form_FORM_ID_alter().
array
buildForm(array $form, FormStateInterface $form_state, ViewExecutable $view = NULL, $output = [])
Form constructor.
validateForm(array $form, FormStateInterface $form_state)
Form validation handler.
submitForm(array $form, FormStateInterface $form_state)
Form submission handler.
protected FormInterface
getFormObject(FormStateInterface $form_state)
Returns the object used to build the step form.