function MachineNameTest::buildForm
Same name and namespace in other branches
- 10 core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php \Drupal\KernelTests\Core\Render\Element\MachineNameTest::buildForm()
- 11.x core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php \Drupal\KernelTests\Core\Render\Element\MachineNameTest::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 FormInterface::buildForm
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Render/ Element/ MachineNameTest.php, line 30
Class
- MachineNameTest
- @coversDefaultClass \Drupal\Core\Render\Element\MachineName @group Render
Namespace
Drupal\KernelTests\Core\Render\ElementCode
public function buildForm(array $form, FormStateInterface $form_state) {
$element = [
'#id' => 'test',
'#type' => 'machine_name',
'#machine_name' => [
'source' => [
'test_source',
],
],
'#name' => 'test_machine_name',
'#default_value' => NULL,
];
$complete_form = [
'test_machine_name' => $element,
'test_source' => [
'#type' => 'textfield',
],
];
return $complete_form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.