function ModalForm::create

Same name in other branches
  1. 3.x modules/form_api_example/src/Form/ModalForm.php \Drupal\form_api_example\Form\ModalForm::create()

Overrides FormBase::create

File

modules/form_api_example/src/Form/ModalForm.php, line 29

Class

ModalForm
Implements the ModalForm form controller.

Namespace

Drupal\form_api_example\Form

Code

public static function create(ContainerInterface $container) {
    // Create a new form object and inject its services.
    $form = new static();
    $form->setRequestStack($container->get('request_stack'));
    $form->setStringTranslation($container->get('string_translation'));
    $form->setMessenger($container->get('messenger'));
    return $form;
}