function FormTestTableForm::buildForm
Same name in other branches
- 9 core/modules/system/tests/modules/form_test/src/Form/FormTestTableForm.php \Drupal\form_test\Form\FormTestTableForm::buildForm()
- 8.9.x core/modules/system/tests/modules/form_test/src/Form/FormTestTableForm.php \Drupal\form_test\Form\FormTestTableForm::buildForm()
- 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestTableForm.php \Drupal\form_test\Form\FormTestTableForm::buildForm()
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.