function FormTestTableSelectDisabledRowsForm::buildForm
Same name and namespace in other branches
- 9 core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectDisabledRowsForm.php \Drupal\form_test\Form\FormTestTableSelectDisabledRowsForm::buildForm()
- 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestTableSelectDisabledRowsForm.php \Drupal\form_test\Form\FormTestTableSelectDisabledRowsForm::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/ FormTestTableSelectDisabledRowsForm.php, line 24
Class
- FormTestTableSelectDisabledRowsForm
- Builds a form to test table select with disabled rows.
Namespace
Drupal\form_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $test_action = NULL) {
$multiple = [
'multiple-true' => TRUE,
'multiple-false' => FALSE,
][$test_action];
$form = $this->tableselectFormBuilder($form, $form_state, [
'#multiple' => $multiple,
'#js_select' => TRUE,
'#ajax' => NULL,
]);
// Disable the second row.
$form['tableselect']['#options']['row2']['#disabled'] = TRUE;
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.