function FormElementMaxlengthTest::buildForm
Same name in other branches
- 9 core/modules/system/tests/src/Kernel/Form/FormElementMaxlengthTest.php \Drupal\Tests\system\Kernel\Form\FormElementMaxlengthTest::buildForm()
- 8.9.x core/modules/system/tests/src/Kernel/Form/FormElementMaxlengthTest.php \Drupal\Tests\system\Kernel\Form\FormElementMaxlengthTest::buildForm()
- 11.x core/modules/system/tests/src/Kernel/Form/FormElementMaxlengthTest.php \Drupal\Tests\system\Kernel\Form\FormElementMaxlengthTest::buildForm()
Overrides FormInterface::buildForm
File
-
core/
modules/ system/ tests/ src/ Kernel/ Form/ FormElementMaxlengthTest.php, line 35
Class
- FormElementMaxlengthTest
- Tests the maxlength HTML attribute on form elements.
Namespace
Drupal\Tests\system\Kernel\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['title'] = [
'#type' => 'textfield',
'#maxlength' => 255,
];
$form['description'] = [
'#type' => 'textarea',
'#maxlength' => 255,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => 'Submit',
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.