You are here

function scheduler_form_alter in Scheduler 7

Same name and namespace in other branches
  1. 5 scheduler.module \scheduler_form_alter()
  2. 6 scheduler.module \scheduler_form_alter()
  3. 2.x scheduler.module \scheduler_form_alter()

Implements hook_form_alter().

File

./scheduler.module, line 214
Scheduler publishes and unpublishes nodes on dates specified by the user.

Code

function scheduler_form_alter(&$form, $form_state) {

  // Load the real code only when needed. First check if this a node form and
  // that the user has permission to use Scheduler.
  if (!empty($form['#node_edit_form']) && user_access('schedule publishing of nodes')) {

    // Check if scheduling has been enabled for this node type.
    $publishing_enabled = variable_get('scheduler_publish_enable_' . $form['type']['#value'], 0) == 1;
    $unpublishing_enabled = variable_get('scheduler_unpublish_enable_' . $form['type']['#value'], 0) == 1;
    if ($publishing_enabled || $unpublishing_enabled) {
      module_load_include('inc', 'scheduler', 'scheduler.edit');
      _scheduler_form_alter($form, $form_state);
    }
  }
}