public function FormTestArgumentsObject::buildForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/form_test/src/FormTestArgumentsObject.php \Drupal\form_test\FormTestArgumentsObject::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- core/
modules/ system/ tests/ modules/ form_test/ src/ FormTestArgumentsObject.php, line 32
Class
- FormTestArgumentsObject
- Provides a test form object that needs arguments.
Namespace
Drupal\form_testCode
public function buildForm(array $form, FormStateInterface $form_state, $arg = NULL) {
$form['element'] = [
'#markup' => 'The FormTestArgumentsObject::buildForm() method was used for this form.',
];
$form['bananas'] = [
'#type' => 'textfield',
'#default_value' => $arg,
'#title' => $this
->t('Bananas'),
];
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Save'),
];
return $form;
}