diff --git b/scheduler.install a/scheduler.install index f4167e8..0074c67 100644 --- b/scheduler.install +++ a/scheduler.install @@ -57,6 +57,7 @@ function scheduler_uninstall() { $types = node_type_get_types(); foreach ($types as $type) { $type_name = $type->type; + $variables[] = "scheduler_expand_fieldset_" . $type_name; $variables[] = "scheduler_publish_enable_" . $type_name; $variables[] = "scheduler_publish_touch_" . $type_name; $variables[] = "scheduler_publish_required_" . $type_name; @@ -66,8 +67,6 @@ function scheduler_uninstall() { $variables[] = "scheduler_unpublish_required_" . $type_name; $variables[] = "scheduler_unpublish_revision_" . $type_name; $variables[] = "scheduler_use_vertical_tabs_" . $type_name; - $variables[] = "scheduler_options_weight_" . $type_name; - $variables[] = "scheduler_expand_fieldset_" . $type_name; } foreach ($variables as $variable) { diff --git b/scheduler.module a/scheduler.module index 7963016..d3aecc3 100644 --- b/scheduler.module +++ a/scheduler.module @@ -301,13 +301,6 @@ function scheduler_form_node_type_form_alter(&$form, $form_state) { '#weight' => 3, '#group' => 'scheduler', ); - $form['scheduler']['node_edit_layout']['scheduler_options_weight'] = array( - '#type' => 'select', - '#title' => t('Scheduling options weight'), - '#options' => drupal_map_assoc(range(-50, 50)), - '#default_value' => variable_get('scheduler_options_weight_' . $form['#node_type']->type, 35), - '#description' => t('A heavier weight will show the scheduling options lower on the page or in a lower vertical tab'), - ); $form['scheduler']['node_edit_layout']['scheduler_use_vertical_tabs'] = array( '#type' => 'radios', '#title' => t('Display scheduling options as'), @@ -316,15 +309,15 @@ function scheduler_form_node_type_form_alter(&$form, $form_state) { '1' => t('Vertical tab'), '0' => t('Separate fieldset'), ), - '#description' => t('Use this option to specify how the scheduling options will be displayed when editing a node'), + '#description' => t('Use this option to specify how the scheduling options will be displayed when editing a node.'), ); $form['scheduler']['node_edit_layout']['scheduler_expand_fieldset'] = array( '#type' => 'radios', '#title' => t('Expand fieldset'), '#default_value' => variable_get('scheduler_expand_fieldset_' . $form['#node_type']->type, 0), '#options' => array( - '1' => t('Always open the fieldset, even if no dates exist'), '0' => t('Expand only when a scheduled date exists or when a date is required'), + '1' => t('Always open the fieldset, even if no dates exist'), ), '#states' => array( 'visible' => array( @@ -384,9 +377,7 @@ function scheduler_form_alter(&$form, $form_state) { $publishing_required = variable_get('scheduler_publish_required_' . $form['type']['#value'], 0) == 1 && $node->status == 0; $unpublishing_required = variable_get('scheduler_unpublish_required_' . $form['type']['#value'], 0) == 1 && $node->status == 1; - $use_vertical_tabs = variable_get('scheduler_use_vertical_tabs_' . $form['type']['#value'], 1); - $weight = variable_get('scheduler_options_weight_' . $form['type']['#value'], 35); $fieldset_extended = ( (isset($defaults->publish_on) && $defaults->publish_on != 0) @@ -401,24 +392,12 @@ function scheduler_form_alter(&$form, $form_state) { '#title' => t('Scheduling options'), '#collapsible' => TRUE, '#collapsed' => !$fieldset_extended, - '#weight' => $weight, + '#weight' => 35, + '#group' => $use_vertical_tabs ? 'additional_settings' : FALSE, ); - if (variable_get('scheduler_use_vertical_tabs_' . $form['type']['#value'], 1)) { - // Add to the 'additional_settings' vertical tab. - $form['scheduler_settings'] += array( - '#group' => 'additional_settings', - '#attached' => array( - 'js' => array( - 'vertical-tabs' => drupal_get_path('module', 'scheduler') . "/scheduler_vertical_tabs.js", - ), - ), - ); - } - else { - // Display as a normal fieldset, not in vertical tabs. - $form['scheduler_settings'] += array( - '#group' => FALSE, - ); + // Attach the javascript for the vertical tabs. + if ($use_vertical_tabs) { + $form['scheduler_settings']['#attached']['js'][] = drupal_get_path('module', 'scheduler') . '/scheduler_vertical_tabs.js'; } $extra_info = variable_get('scheduler_extra_info', ''); @@ -1141,18 +1120,23 @@ function scheduler_views_api() { } /** - * Implements hook_content_extra_fields(). + * Implements hook_field_extra_fields(). */ -function scheduler_content_extra_fields($type_name) { +function scheduler_field_extra_fields() { $fields = array(); - $publishing_enabled = variable_get('scheduler_publish_enable_' . $type_name, 0) == 1; - $unpublishing_enabled = variable_get('scheduler_unpublish_enable_' . $type_name, 0) == 1; - if ($publishing_enabled || $unpublishing_enabled) { - $fields['scheduler_settings'] = array( - 'label' => t('Scheduler'), - 'description' => t('Scheduler module form.'), - 'weight' => 10, - ); + + foreach (node_type_get_types() as $type) { + $publishing_enabled = variable_get('scheduler_publish_enable_' . $type->type, 0); + $unpublishing_enabled = variable_get('scheduler_unpublish_enable_' . $type->type, 0); + $use_vertical_tabs = variable_get('scheduler_use_vertical_tabs_' . $type->type, 1); + + if (($publishing_enabled || $unpublishing_enabled) && !$use_vertical_tabs) { + $fields['node'][$type->type]['form']['scheduler_settings'] = array( + 'label' => t('Scheduler'), + 'description' => t('Fieldset containing scheduling settings'), + 'weight' => 0, + ); + } } return $fields; }