You are here

function revision_scheduler_menu in Revision scheduler 7

Implements hook_menu().

File

./revision_scheduler.module, line 20

Code

function revision_scheduler_menu() {

  // Both diff and workbench_moderation modules add a default local task, so
  // only add this item if those modules are not available.
  if (!module_exists('diff') && !module_exists('workbench_moderation')) {
    $items['node/%node/revisions/list'] = array(
      'title' => 'List',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
      'file path' => drupal_get_path('module', 'node'),
    );
  }
  $items['node/%node/revisions/schedule'] = array(
    'title' => 'Schedule',
    'page callback' => 'revision_scheduler_list_page',
    'page arguments' => array(
      'node',
      1,
    ),
    'access arguments' => array(
      'schedule revisions',
    ),
    'file' => 'revision_scheduler.pages.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $items['node/%node/revisions/schedule/add'] = array(
    'title' => 'Add scheduled revision',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'revision_scheduler_add_form',
      'node',
      1,
    ),
    'access callback' => 'revision_scheduler_operation_create_access',
    'access arguments' => array(
      'node',
      1,
      NULL,
      TRUE,
    ),
    'file' => 'revision_scheduler.pages.inc',
    'type' => MENU_LOCAL_ACTION,
  );

  // Support workbench moderation paths.
  if (module_exists('workbench_moderation')) {
    foreach ($items as $path => $item) {
      $moderation_path = str_replace('/revisions/', '/moderation/', $path);
      $items[$moderation_path] = $item;
    }
  }
  $items['revision-scheduler/%revision_scheduler_operation/run'] = array(
    'title' => 'Edit scheduled revision',
    'page callback' => 'revision_scheduler_operation_run',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'revision_scheduler_operation_access',
    'access arguments' => array(
      'run',
      1,
    ),
    'type' => MENU_CALLBACK,
  );
  $items['revision-scheduler/%revision_scheduler_operation/edit'] = array(
    'title' => 'Edit scheduled revision',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'revision_scheduler_edit_form',
      1,
    ),
    'access callback' => 'revision_scheduler_operation_access',
    'access arguments' => array(
      'update',
      1,
    ),
    'file' => 'revision_scheduler.pages.inc',
  );
  $items['revision-scheduler/%revision_scheduler_operation/delete'] = array(
    'title' => 'Cancel scheduled revision',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'revision_scheduler_delete_form',
      1,
    ),
    'access callback' => 'revision_scheduler_operation_access',
    'access arguments' => array(
      'delete',
      1,
    ),
    'file' => 'revision_scheduler.pages.inc',
  );
  return $items;
}