public function FormTestVerticalTabsAccessForm::buildForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/tests/modules/form_test/src/Form/FormTestVerticalTabsAccessForm.php \Drupal\form_test\Form\FormTestVerticalTabsAccessForm::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/ FormTestVerticalTabsAccessForm.php, line 25 - Contains \Drupal\form_test\Form\FormTestVerticalTabsAccessForm.
Class
Namespace
Drupal\form_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['vertical_tabs1'] = array(
'#type' => 'vertical_tabs',
);
$form['tab1'] = array(
'#type' => 'fieldset',
'#title' => t('Tab 1'),
'#collapsible' => TRUE,
'#group' => 'vertical_tabs1',
);
$form['tab1']['field1'] = array(
'#title' => t('Field 1'),
'#type' => 'checkbox',
'#default_value' => TRUE,
);
$form['tab2'] = array(
'#type' => 'fieldset',
'#title' => t('Tab 2'),
'#collapsible' => TRUE,
'#group' => 'vertical_tabs1',
);
$form['tab2']['field2'] = array(
'#title' => t('Field 2'),
'#type' => 'textfield',
'#default_value' => 'field2',
);
$form['fieldset1'] = array(
'#type' => 'fieldset',
'#title' => t('Fieldset'),
);
$form['fieldset1']['field3'] = array(
'#type' => 'checkbox',
'#title' => t('Field 3'),
'#default_value' => TRUE,
);
$form['container'] = array(
'#type' => 'container',
);
$form['container']['field4'] = array(
'#type' => 'checkbox',
'#title' => t('Field 4'),
'#default_value' => TRUE,
);
$form['container']['subcontainer'] = array(
'#type' => 'container',
);
$form['container']['subcontainer']['field5'] = array(
'#type' => 'checkbox',
'#title' => t('Field 5'),
'#default_value' => TRUE,
);
$form['vertical_tabs2'] = array(
'#type' => 'vertical_tabs',
);
$form['tab3'] = array(
'#type' => 'fieldset',
'#title' => t('Tab 3'),
'#collapsible' => TRUE,
'#group' => 'vertical_tabs2',
);
$form['tab3']['field6'] = array(
'#title' => t('Field 6'),
'#type' => 'checkbox',
'#default_value' => TRUE,
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}