W3cubDocs

/Drupal 8

public function FormBuilderInterface::getForm

public FormBuilderInterface::getForm($form_arg)

Gets a renderable form array.

This function should be used instead of self::buildForm() when $form_state is not needed (i.e., when initially rendering the form) and is often used as a menu callback.

Parameters

\Drupal\Core\Form\FormInterface|string $form_arg: The value must be one of the following:

...: Any additional arguments are passed on to the functions called by \Drupal::formBuilder()->getForm(), including the unique form constructor function. For example, the node_edit form requires that a node object is passed in here when it is called. These are available to implementations of hook_form_alter() and hook_form_FORM_ID_alter() as the array $form_state->getBuildInfo()['args'].

Return value

array The form array.

See also

\Drupal\Core\Form\FormBuilderInterface::buildForm()

File

core/lib/Drupal/Core/Form/FormBuilderInterface.php, line 62

Class

FormBuilderInterface
Provides an interface for form building and processing.

Namespace

Drupal\Core\Form

Code

public function getForm($form_arg);

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Form!FormBuilderInterface.php/function/FormBuilderInterface::getForm/8.1.x