function BatchExampleForm::buildForm
Same name in other branches
- 3.x modules/batch_example/src/Form/BatchExampleForm.php \Drupal\batch_example\Form\BatchExampleForm::buildForm()
Overrides FormInterface::buildForm
File
-
modules/
batch_example/ src/ Form/ BatchExampleForm.php, line 23
Class
- BatchExampleForm
- Form with examples on how to use cache.
Namespace
Drupal\batch_example\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['description'] = [
'#type' => 'markup',
'#markup' => $this->t('This example offers two different batches. The first does 1000 identical operations, each completed in on run; the second does 20 operations, but each takes more than one run to operate if there are more than 5 nodes.'),
];
$form['batch'] = [
'#type' => 'select',
'#title' => 'Choose batch',
'#options' => [
'batch_1' => $this->t('batch 1 - 1000 operations'),
'batch_2' => $this->t('batch 2 - 20 operations.'),
],
];
$form['submit'] = [
'#type' => 'submit',
'#value' => 'Go',
];
return $form;
}