function _scheduler_form_node_type_form_alter in Scheduler 7
Same name and namespace in other branches
- 8 scheduler.admin.inc \_scheduler_form_node_type_form_alter()
Helper function for the real hook_form_node_type_form_alter().
See also
scheduler_form_node_type_form_alter()
1 call to _scheduler_form_node_type_form_alter()
- scheduler_form_node_type_form_alter in ./
scheduler.module - Implements hook_form_node_type_form_alter().
File
- ./
scheduler.admin.inc, line 251 - Administration forms for the Scheduler module.
Code
function _scheduler_form_node_type_form_alter(&$form, $form_state) {
$form['scheduler'] = array(
'#type' => 'fieldset',
'#title' => t('Scheduler'),
'#weight' => 35,
'#group' => 'additional_settings',
'#attached' => array(
'js' => array(
'vertical-tabs' => _scheduler_get_vertical_tabs_js(),
),
),
);
$form['scheduler']['publish'] = array(
'#type' => 'fieldset',
'#title' => t('Publishing'),
'#collapsible' => FALSE,
'#weight' => 1,
'#group' => 'scheduler',
);
$form['scheduler']['publish']['scheduler_publish_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable scheduled publishing for this content type'),
'#default_value' => variable_get('scheduler_publish_enable_' . $form['#node_type']->type, 0),
);
$form['scheduler']['publish']['scheduler_publish_touch'] = array(
'#type' => 'checkbox',
'#title' => t('Change content creation time to match the scheduled publish time'),
'#default_value' => variable_get('scheduler_publish_touch_' . $form['#node_type']->type, 0),
'#states' => array(
'visible' => array(
':input[name="scheduler_publish_enable"]' => array(
'checked' => TRUE,
),
),
),
);
$form['scheduler']['publish']['scheduler_publish_required'] = array(
'#type' => 'checkbox',
'#title' => t('Require scheduled publishing'),
'#default_value' => variable_get('scheduler_publish_required_' . $form['#node_type']->type, 0),
'#states' => array(
'visible' => array(
':input[name="scheduler_publish_enable"]' => array(
'checked' => TRUE,
),
),
),
);
$form['scheduler']['publish']['scheduler_publish_revision'] = array(
'#type' => 'checkbox',
'#title' => t('Create a new revision on publishing'),
'#default_value' => variable_get('scheduler_publish_revision_' . $form['#node_type']->type, 0),
'#states' => array(
'visible' => array(
':input[name="scheduler_publish_enable"]' => array(
'checked' => TRUE,
),
),
),
);
$form['scheduler']['publish']['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#states' => array(
'visible' => array(
':input[name="scheduler_publish_enable"]' => array(
'checked' => TRUE,
),
),
),
);
$form['scheduler']['publish']['advanced']['scheduler_publish_past_date'] = array(
'#type' => 'radios',
'#title' => t('Action to be taken for publication dates in the past'),
'#default_value' => variable_get('scheduler_publish_past_date_' . $form['#node_type']->type, 'error'),
'#options' => array(
'error' => t('Display an error message - do not allow dates in the past'),
'publish' => t('Publish the content immediately after saving'),
'schedule' => t('Schedule the content for publication on the next cron run'),
),
);
$form['scheduler']['unpublish'] = array(
'#type' => 'fieldset',
'#title' => t('Unpublishing'),
'#collapsible' => FALSE,
'#weight' => 2,
'#group' => 'scheduler',
);
$form['scheduler']['unpublish']['scheduler_unpublish_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable scheduled unpublishing for this content type'),
'#default_value' => variable_get('scheduler_unpublish_enable_' . $form['#node_type']->type, 0),
);
$form['scheduler']['unpublish']['scheduler_unpublish_required'] = array(
'#type' => 'checkbox',
'#title' => t('Require scheduled unpublishing'),
'#default_value' => variable_get('scheduler_unpublish_required_' . $form['#node_type']->type, 0),
'#states' => array(
'visible' => array(
':input[name="scheduler_unpublish_enable"]' => array(
'checked' => TRUE,
),
),
),
);
$form['scheduler']['unpublish']['scheduler_unpublish_revision'] = array(
'#type' => 'checkbox',
'#title' => t('Create a new revision on unpublishing'),
'#default_value' => variable_get('scheduler_unpublish_revision_' . $form['#node_type']->type, 0),
'#states' => array(
'visible' => array(
':input[name="scheduler_unpublish_enable"]' => array(
'checked' => TRUE,
),
),
),
);
// The 'node_edit_layout' fieldset contains options to alter the layout of
// node edit pages.
$form['scheduler']['node_edit_layout'] = array(
'#type' => 'fieldset',
'#title' => t('Node edit page layout'),
'#collapsible' => FALSE,
'#weight' => 3,
'#group' => 'scheduler',
// The #states processing only caters for AND and does not do OR. So to set
// the state to visible if either of the boxes are ticked we use the fact
// that logical 'X = A or B' is equivalent to 'not X = not A and not B'.
'#states' => array(
'!visible' => array(
':input[name="scheduler_publish_enable"]' => array(
'!checked' => TRUE,
),
':input[name="scheduler_unpublish_enable"]' => array(
'!checked' => TRUE,
),
),
),
);
$form['scheduler']['node_edit_layout']['scheduler_use_vertical_tabs'] = array(
'#type' => 'radios',
'#title' => t('Display scheduling options as'),
'#default_value' => variable_get('scheduler_use_vertical_tabs_' . $form['#node_type']->type, 1),
'#options' => array(
'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.'),
);
$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(
'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(
':input[name="scheduler_use_vertical_tabs"]' => array(
'value' => '0',
),
),
),
);
}