Newer
Older
Alex Pott
committed
<?php
namespace Drupal\batch_test\Form;
use Drupal\Core\Form\FormBase;
Dries Buytaert
committed
use Drupal\Core\Form\FormStateInterface;
Alex Pott
committed
/**
* Generate form of id batch_test_mock_form.
*/
class BatchTestMockForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'batch_test_mock_form';
}
/**
* {@inheritdoc}
*/
Dries Buytaert
committed
public function buildForm(array $form, FormStateInterface $form_state) {
$form['test_value'] = [
Alex Pott
committed
'#title' => t('Test value'),
'#type' => 'textfield',
];
$form['submit'] = [
Alex Pott
committed
'#type' => 'submit',
'#value' => t('Submit'),
];
Alex Pott
committed
return $form;
}
/**
* {@inheritdoc}
*/
Dries Buytaert
committed
public function submitForm(array &$form, FormStateInterface $form_state) {
Alex Pott
committed
batch_test_stack('mock form submitted with value = ' . $form_state->getValue('test_value'));