function vertical_tabs_config_vertical_tab_list in Vertical Tabs Config 8
Same name and namespace in other branches
- 7 vertical_tabs_config.module \vertical_tabs_config_vertical_tab_list()
Returns a list of all vertical tabs.
Parameters
bool $ordered_by_weight Return a list ordered by weight?:
Return value
array List of vertical tabs
5 calls to vertical_tabs_config_vertical_tab_list()
- OrderConfigurationForm::buildForm in src/
Form/ OrderConfigurationForm.php - Form constructor.
- OrderConfigurationForm::submitForm in src/
Form/ OrderConfigurationForm.php - Form submission handler.
- vertical_tabs_config_form_node_form_alter in ./
vertical_tabs_config.module - Implements hook_form_BASE_FORM_ID_alter().
- VisibilityConfigurationForm::buildForm in src/
Form/ VisibilityConfigurationForm.php - Form constructor.
- VisibilityConfigurationForm::submitForm in src/
Form/ VisibilityConfigurationForm.php - Form submission handler.
File
- ./
vertical_tabs_config.module, line 114 - Vertical tabs config main file.
Code
function vertical_tabs_config_vertical_tab_list($ordered_by_weight = FALSE) {
$config = \Drupal::config('vertical_tabs_config.order');
$vertical_tabs = [
'options' => t('Promotion options'),
'menu' => t('Menu settings'),
'revision_information' => t('Revision information'),
'path_settings' => t('URL path settings'),
'author' => t('Authoring information'),
'book' => t('Book outline'),
'ds_switch_view_mode' => t('Display settings'),
];
if ($ordered_by_weight) {
$unordered = [];
foreach ($vertical_tabs as $vt_machine_name => $vt_human_name) {
$weight = $config
->get('vertical_tabs_config_' . $vt_machine_name);
$unordered[$weight] = [
'key' => $vt_machine_name,
'value' => $vt_human_name,
];
}
ksort($unordered);
$vertical_tabs = [];
foreach ($unordered as $vt_assoc) {
$vertical_tabs[$vt_assoc['key']] = $vt_assoc['value'];
}
}
return $vertical_tabs;
}