function vertical_tabs_config_admin_settings in Vertical Tabs Config 7
Visibility configuration form.
1 string reference to 'vertical_tabs_config_admin_settings'
- vertical_tabs_config_menu in ./
vertical_tabs_config.module - Implements hook_menu().
File
- ./
vertical_tabs_config.admin.inc, line 11 - Administration page.
Code
function vertical_tabs_config_admin_settings() {
$roles = user_roles();
$ct_list = node_type_get_types();
$vertical_tabs = vertical_tabs_config_vertical_tab_list();
$conf = vertical_tabs_config_get_config();
$form['desc'] = array(
'#type' => 'item',
'#markup' => t('For each content type, select which vertical tabs need to be hidden depending on roles.'),
);
$form['vt'] = array(
'#type' => 'vertical_tabs',
'#title' => 'Configuration',
);
foreach ($ct_list as $ct_machine_name => $obj) {
$form['vt']['hide_' . $ct_machine_name] = array(
'#type' => 'fieldset',
'#title' => $obj->name,
'#weight' => 5,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'content_types_config',
);
$form['vt']['hide_' . $ct_machine_name]['config'] = array(
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#collapsed' => TRUE,
);
$form['vt']['hide_' . $ct_machine_name]['config']['desc'] = array(
'#type' => 'item',
'#markup' => t("Select all vertical tabs that will be hidden for @ct. If you don't select any role, vertical tabs will be hidden to all roles.", array(
'@ct' => $obj->name,
)),
);
$form['vt']['hide_' . $ct_machine_name]['config']['roles'] = array(
'#type' => 'fieldset',
'#title' => t('Hide only by role'),
'#weight' => 5,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#group' => 'content_types_config_roles',
);
$form['vt']['hide_' . $ct_machine_name]['config']['tabs'] = array(
'#type' => 'fieldset',
'#title' => t('Hidded vertical tabs'),
'#weight' => 6,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#group' => 'content_types_config_tabs',
);
foreach ($roles as $rid => $value) {
$def = 0;
if (isset($conf[$ct_machine_name]['roles']) && is_array($conf[$ct_machine_name]['roles'])) {
if (in_array($rid, $conf[$ct_machine_name]['roles'])) {
$def = 1;
}
}
$form['vt']['hide_' . $ct_machine_name]['config']['roles']['role_' . $ct_machine_name . '_' . $rid] = array(
'#type' => 'checkbox',
'#title' => t('Apply config for') . ' ' . $value,
'#default_value' => $def,
'#group' => 'vertical_tabs_roles',
);
}
foreach ($vertical_tabs as $vt_machine_name => $vt_human_name) {
$def = isset($conf[$ct_machine_name][$vt_machine_name]) ? $conf[$ct_machine_name][$vt_machine_name] : 0;
$form['vt']['hide_' . $ct_machine_name]['config']['tabs']['hide_' . $ct_machine_name . '_' . $vt_machine_name] = array(
'#type' => 'checkbox',
'#title' => t('Hide') . ' ' . $vt_human_name,
'#default_value' => $def,
'#group' => 'vertical_tabs_hide',
);
}
}
$form['#submit'][] = 'vertical_tabs_config_admin_settings_submit';
return system_settings_form($form, TRUE);
}