You are here

public function BatchTestSimpleForm::buildForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/batch_test/src/Form/BatchTestSimpleForm.php \Drupal\batch_test\Form\BatchTestSimpleForm::buildForm()
  2. 10 core/modules/system/tests/modules/batch_test/src/Form/BatchTestSimpleForm.php \Drupal\batch_test\Form\BatchTestSimpleForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

core/modules/system/tests/modules/batch_test/src/Form/BatchTestSimpleForm.php, line 25

Class

BatchTestSimpleForm
Generate form of id batch_test_simple_form.

Namespace

Drupal\batch_test\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['batch'] = [
    '#type' => 'select',
    '#title' => 'Choose batch',
    '#options' => [
      'batch_0' => 'batch 0',
      'batch_1' => 'batch 1',
      'batch_2' => 'batch 2',
      'batch_3' => 'batch 3',
      'batch_4' => 'batch 4',
      'batch_6' => 'batch 6',
      'batch_7' => 'batch 7',
    ],
    '#multiple' => TRUE,
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => 'Submit',
  ];
  return $form;
}