public function MachineNameTest::buildForm in Drupal 10
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;
}