function BatchTestSimpleForm::buildForm

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

Overrides FormInterface::buildForm

File

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

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',
            'batch_8' => 'batch 8',
        ],
        '#multiple' => TRUE,
    ];
    $form['submit'] = [
        '#type' => 'submit',
        '#value' => 'Submit',
    ];
    return $form;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.