protected function SystemThemeSettings::createGroups in Express 8
Sets up the vertical tab groupings.
Parameters
\Drupal\bootstrap\Utility\Element $form: The Element object that comprises the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
1 call to SystemThemeSettings::createGroups()
- SystemThemeSettings::alterFormElement in themes/
contrib/ bootstrap/ src/ Plugin/ Form/ SystemThemeSettings.php - The alter method to store the code.
File
- themes/
contrib/ bootstrap/ src/ Plugin/ Form/ SystemThemeSettings.php, line 50 - Contains \Drupal\bootstrap\Plugin\Form\SystemThemeSettings.
Class
- SystemThemeSettings
- Implements hook_form_system_theme_settings_alter().
Namespace
Drupal\bootstrap\Plugin\FormCode
protected function createGroups(Element $form, FormStateInterface $form_state) {
// Vertical tabs for global settings provided by core or contrib modules.
if (!isset($form['global'])) {
$form['global'] = [
'#type' => 'vertical_tabs',
'#weight' => -9,
'#prefix' => '<h2><small>' . t('Override Global Settings') . '</small></h2>',
];
}
// Iterate over existing children and move appropriate ones to global group.
foreach ($form
->children() as $child) {
if ($child
->isType([
'details',
'fieldset',
]) && !$child
->hasProperty('group')) {
$child
->setProperty('type', 'details');
$child
->setProperty('group', 'global');
}
}
// Provide the necessary default groups.
$form['bootstrap'] = [
'#type' => 'vertical_tabs',
'#attached' => [
'library' => [
'bootstrap/theme-settings',
],
],
'#prefix' => '<h2><small>' . t('Bootstrap Settings') . '</small></h2>',
'#weight' => -10,
];
$groups = [
'general' => t('General'),
'components' => t('Components'),
'javascript' => t('JavaScript'),
'advanced' => t('Advanced'),
];
foreach ($groups as $group => $title) {
$form[$group] = [
'#type' => 'details',
'#title' => $title,
'#group' => 'bootstrap',
];
}
}