You are here

public function TwigExtension::drupalForm in Twig Tweak 8

Same name and namespace in other branches
  1. 8.2 src/TwigExtension.php \Drupal\twig_tweak\TwigExtension::drupalForm()

Builds and processes a form for a given form ID.

Parameters

string $form_id: The form ID.

...: Additional arguments are passed to form constructor.

Return value

array A render array to represent the form.

File

src/TwigExtension.php, line 270

Class

TwigExtension
Twig extension with some useful functions and filters.

Namespace

Drupal\twig_tweak

Code

public function drupalForm($form_id) {
  $form_builder = \Drupal::formBuilder();
  $args = func_get_args();
  return call_user_func_array([
    $form_builder,
    'getForm',
  ], $args);
}