function FormTestServiceObject::buildForm
Same name in other branches
- 8.9.x core/modules/system/tests/modules/form_test/src/FormTestServiceObject.php \Drupal\form_test\FormTestServiceObject::buildForm()
- 10 core/modules/system/tests/modules/form_test/src/FormTestServiceObject.php \Drupal\form_test\FormTestServiceObject::buildForm()
- 11.x core/modules/system/tests/modules/form_test/src/FormTestServiceObject.php \Drupal\form_test\FormTestServiceObject::buildForm()
Overrides ConfigFormBase::buildForm
File
-
core/
modules/ system/ tests/ modules/ form_test/ src/ FormTestServiceObject.php, line 32
Class
- FormTestServiceObject
- Provides a test form object.
Namespace
Drupal\form_testCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['element'] = [
'#markup' => 'The FormTestServiceObject::buildForm() method was used for this form.',
];
$form['bananas'] = [
'#type' => 'textfield',
'#default_value' => 'brown',
'#title' => $this->t('Bananas'),
];
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Save'),
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.