You are here

public static function TwigTweakExtension::drupalForm in Twig Tweak 3.1.x

Same name and namespace in other branches
  1. 3.x src/TwigTweakExtension.php \Drupal\twig_tweak\TwigTweakExtension::drupalForm()

Builds and processes a form for a given form ID.

Parameters

string $form_id: The form ID.

mixed $args: Additional arguments are passed to form constructor.

Return value

array A render array to represent the form.

File

src/TwigTweakExtension.php, line 222

Class

TwigTweakExtension
Twig extension with some useful functions and filters.

Namespace

Drupal\twig_tweak

Code

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