class SessionTestForm
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/session_test/src/Form/SessionTestForm.php \Drupal\session_test\Form\SessionTestForm
Form controller for the test config edit forms.
@internal
Hierarchy
- class \Drupal\Core\Form\FormBase extends \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\session_test\Form\SessionTestForm implements \Drupal\Core\Form\FormBase
Expanded class hierarchy of SessionTestForm
1 string reference to 'SessionTestForm'
- session_test.routing.yml in core/
modules/ system/ tests/ modules/ session_test/ session_test.routing.yml - core/modules/system/tests/modules/session_test/session_test.routing.yml
File
-
core/
modules/ system/ tests/ modules/ session_test/ src/ Form/ SessionTestForm.php, line 14
Namespace
Drupal\session_test\FormView source
class SessionTestForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'session_test_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['input'] = [
'#type' => 'textfield',
'#title' => 'Input',
'#required' => TRUE,
];
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => 'Save',
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->messenger()
->addStatus(new FormattableMarkup('Ok: @input', [
'@input' => $form_state->getValue('input'),
]));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.