--- /old/cck_fieldgroup_tabs.module +++ cck_fieldgroup_tabs.module @@ -68,7 +68,24 @@ '#default_value' => variable_get('cck_fieldset_tabs_residual_title_'.$type, t('Basics')), ); } - + + //add admin tabs + $form['cck_fieldset_admin'] = array('#type' => 'fieldset', '#title' => t('Admin Tab Info')); + $form['cck_fieldset_admin']['cck_fieldset_tabs_admin_residual'] = array( + '#type' => 'radios', + '#title' => t('Admin tab'), + '#description' => t('Enable this option to give nodes with tabs a new tab containing all admin fields (e.g., comment settings, menu, path).'), + '#options' => array(t('Disabled'), t('Enabled')), + '#default_value' => variable_get('cck_fieldset_tabs_admin_residual', 0), + ); + $form['cck_fieldset_admin']['cck_fieldset_tabs_admin_residual_weight'] = array( + '#type' => 'weight', + '#delta' => 30, + '#title' => t('Admin Tab weight'), + '#description' => t('Enter a weight for the "Admin" tab.'), + '#default_value' => variable_get('cck_fieldset_tabs_admin_residual_weight', 20), + ); + $form = system_settings_form($form); return $form; } @@ -102,6 +119,35 @@ } } $node_type = $form['type']['#value']; + + //admin tabs + $admin_keys=array('comment_settings', 'menu', 'author', 'log', 'options', 'path', 'revision_information', 'book'); + if (isset($form['fieldgroup_tabs']) && variable_get('cck_fieldset_tabs_admin_residual', FALSE)) { + // Add residual content to a tab if desired. + $title = t('Admin'); + $residual_admin = array( + '#type' => 'tabpage', + // Pass the value through t() if needed. + '#title' => $title, + '#weight' => variable_get('cck_fieldset_tabs_admin_residual_weight', -20), + ); + + + + foreach (element_children($form) as $key) { + // Skip the buttons so that they are below the tabset. Don't process + // hidden or value fields. + // skip anything that is not in the admin tab + if (in_array($key, $admin_keys) && $key != 'fieldgroup_tabs' && $key != 'buttons' && (!isset($form[$key]['#type']) || !in_array($form[$key]['#type'], array('hidden', 'value')))) { + //drupal_set_message($key); + $residual_admin[$key] = $form[$key]; + unset($form[$key]); + } + } + $form['fieldgroup_tabs']['fieldgroup_tabs_admin'] = $residual_admin; + } + + if (isset($form['fieldgroup_tabs']) && variable_get('cck_fieldset_tabs_residual', FALSE)) { // Add residual content to a tab if desired. $title = t(variable_get('cck_fieldset_tabs_residual_title_'.$node_type, variable_get('cck_fieldset_tabs_residual_title', t('Basics'))));