diff --git a/scheduler.install b/scheduler.install index 4584f80..e925946 100644 --- a/scheduler.install +++ b/scheduler.install @@ -63,6 +63,8 @@ function scheduler_uninstall() { $variables[] = "scheduler_unpublish_enable_" . $type_name; $variables[] = "scheduler_unpublish_required_" . $type_name; $variables[] = "scheduler_unpublish_revision_" . $type_name; + $variables[] = "scheduler_use_vertical_tabs_" . $type_name; + $variables[] = "scheduler_no_vert_tabs_get_weight_" . $type_name; } foreach ($variables as $variable) { @@ -105,6 +107,8 @@ function scheduler_update_6101() { variable_set('scheduler_publish_enable_'. $type_name, $publish_enable); variable_set('scheduler_unpublish_enable_'. $type_name, $publish_enable); variable_set('scheduler_publish_touch_'. $type_name, $publish_touch); + variable_set('scheduler_use_vertical_tabs_' . $type_name, 1); + variable_set('scheduler_no_vert_tabs_get_weight_' . $type_name, 35); variable_del('scheduler_touch_'. $type_name); variable_del('scheduler_'. $type_name); diff --git a/scheduler.module b/scheduler.module index 48b22d1..8a73772 100644 --- a/scheduler.module +++ b/scheduler.module @@ -233,6 +233,24 @@ function scheduler_form_node_type_form_alter(&$form, $form_state) { '#title' => t('Create a new revision on publishing'), '#default_value' => variable_get('scheduler_publish_revision_' . $form['#node_type']->type, 0), ); + $form['scheduler']['publish']['scheduler_use_vertical_tabs'] = array( + '#type' => 'checkbox', + '#title' => t('Show Scheduling options in vertical tabs'), + '#default_value' => variable_get('scheduler_use_vertical_tabs_' . $form['#node_type']->type, 1), + '#description' => t('Uncheck this box if you\'d like to show these options apart from Vertical Tabs.'), + ); + $form['scheduler']['publish']['scheduler_no_vert_tabs_get_weight'] = array( + '#type' => 'textfield', + '#maxlength' => 3, + '#title' => t('Set the weight of \'Scheduling options\' here.'), + '#default_value' => variable_get('scheduler_no_vert_tabs_get_weight_' . $form['#node_type']->type, NULL), + '#description' => t('You\'ve chosen to display \'Scheduling options\' apart from Vertical Tabs. Please enter a weight here to move \'Scheduling options\' up or down on the \'node/add\' and \'node/edit pages\'.'), + '#states' => array( + 'visible' => array( + ':input[name="scheduler_use_vertical_tabs"]' => array('checked' => FALSE) + ), + ), + ); $form['scheduler']['unpublish'] = array( '#type' => 'fieldset', '#title' => 'Unpublishing', @@ -305,6 +323,8 @@ function scheduler_form_alter(&$form, $form_state) { $publishing_required = variable_get('scheduler_publish_required_'. $form['type']['#value'], 0) == 1; $unpublishing_required = variable_get('scheduler_unpublish_required_'. $form['type']['#value'], 0) == 1; + $use_vertical_tabs = variable_get('scheduler_use_vertical_tabs_' . $form['type']['#value'], 1); + $no_vertical_tabs_weight = variable_get('scheduler_no_vert_tabs_get_weight_'. $form['type']['#value'], 35); $fieldset_extended = ( (isset($defaults->publish_on) && $defaults->publish_on != 0) @@ -313,19 +333,30 @@ function scheduler_form_alter(&$form, $form_state) { || $unpublishing_required ); - $form['scheduler_settings'] = array( - '#type' => 'fieldset', - '#title' => t('Scheduling options'), - '#collapsible' => TRUE, - '#collapsed' => !$fieldset_extended, - '#weight' => 35, - '#group' => 'additional_settings', - '#attached' => array( - 'js' => array( - 'vertical-tabs' => drupal_get_path('module', 'scheduler') . "/scheduler_vertical_tabs.js" + if (variable_get('scheduler_use_vertical_tabs_' . $form['type']['#value'], 0) == 1) { + $form['scheduler_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Scheduling options'), + '#collapsible' => TRUE, + '#collapsed' => !$fieldset_extended, + '#weight' => 35, + '#group' => 'additional_settings', + '#attached' => array( + 'js' => array( + 'vertical-tabs' => drupal_get_path('module', 'scheduler') . "/scheduler_vertical_tabs.js" + ), ), - ) - ); + ); + } else { + $form['scheduler_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Scheduling options'), + '#collapsible' => TRUE, + '#collapsed' => FALSE, + '#weight' => $no_vertical_tabs_weight, + '#group' => FALSE, + ); + } $extra_info = variable_get('scheduler_extra_info', ''); if ($extra_info && $extra_info != '') {