public function FormTestTableForm::buildForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/form_test/src/Form/FormTestTableForm.php \Drupal\form_test\Form\FormTestTableForm::buildForm()
- 9 core/modules/system/tests/modules/form_test/src/Form/FormTestTableForm.php \Drupal\form_test\Form\FormTestTableForm::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/
modules/ system/ tests/ modules/ form_test/ src/ Form/ FormTestTableForm.php, line 24
Class
- FormTestTableForm
- Form constructor for testing #type 'table' elements.
Namespace
Drupal\form_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['table'] = [
'#type' => 'table',
'#tableselect' => TRUE,
'#empty' => $this
->t('Empty text.'),
];
$form['table']['row'] = [
'data' => [
'#title' => '<em>kitten</em>',
'#markup' => '<p>some text</p>',
],
];
$form['table']['another_row'] = [
'data' => [
'#title' => $this
->t('my favorite fruit is <strong>@fruit</strong>', [
'@fruit' => 'bananas',
]),
'#markup' => '<p>some more text</p>',
],
];
return $form;
}