function TextForm::buildForm
Same name in other branches
- 3.x modules/theming_example/src/Form/TextForm.php \Drupal\theming_example\Form\TextForm::buildForm()
Overrides FormInterface::buildForm
File
-
modules/
theming_example/ src/ Form/ TextForm.php, line 26
Class
- TextForm
- A simple form that displays a textfield and submit button.
Namespace
Drupal\theming_example\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['text'] = [
'#type' => 'textfield',
'#title' => $this->t('Please input something!'),
'#required' => TRUE,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Go'),
];
return $form;
}