You are here

public function BatchTestChainedForm::buildForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/batch_test/src/Form/BatchTestChainedForm.php \Drupal\batch_test\Form\BatchTestChainedForm::buildForm()
  2. 10 core/modules/system/tests/modules/batch_test/src/Form/BatchTestChainedForm.php \Drupal\batch_test\Form\BatchTestChainedForm::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/BatchTestChainedForm.php, line 25

Class

BatchTestChainedForm
Generate form of id batch_test_chained_form.

Namespace

Drupal\batch_test\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  // This value is used to test that $form_state persists through batched
  // submit handlers.
  $form['value'] = [
    '#type' => 'textfield',
    '#title' => 'Value',
    '#default_value' => 1,
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => 'Submit',
  ];
  $form['#submit'] = [
    'Drupal\\batch_test\\Form\\BatchTestChainedForm::batchTestChainedFormSubmit1',
    'Drupal\\batch_test\\Form\\BatchTestChainedForm::batchTestChainedFormSubmit2',
    'Drupal\\batch_test\\Form\\BatchTestChainedForm::batchTestChainedFormSubmit3',
    'Drupal\\batch_test\\Form\\BatchTestChainedForm::batchTestChainedFormSubmit4',
  ];
  return $form;
}