Version 1
[yaffs-website] / web / core / modules / system / tests / modules / batch_test / src / Form / BatchTestMockForm.php
1 <?php
2
3 namespace Drupal\batch_test\Form;
4
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Generate form of id batch_test_mock_form.
10  */
11 class BatchTestMockForm extends FormBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getFormId() {
17     return 'batch_test_mock_form';
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   public function buildForm(array $form, FormStateInterface $form_state) {
24     $form['test_value'] = [
25       '#title' => t('Test value'),
26       '#type' => 'textfield',
27     ];
28     $form['submit'] = [
29       '#type' => 'submit',
30       '#value' => t('Submit'),
31     ];
32
33     return $form;
34   }
35
36   /**
37    * {@inheritdoc}
38    */
39   public function submitForm(array &$form, FormStateInterface $form_state) {
40     batch_test_stack('mock form submitted with value = ' . $form_state->getValue('test_value'));
41   }
42
43 }