You are here

function workbench_moderation_menu in Workbench Moderation 7

Same name and namespace in other branches
  1. 7.3 workbench_moderation.module \workbench_moderation_menu()
  2. 7.2 workbench_moderation.module \workbench_moderation_menu()

Implements hook_menu().

File

./workbench_moderation.module, line 14
Content moderation for Workbench.

Code

function workbench_moderation_menu() {
  $items = array();

  // Display a node's moderation history
  $items["node/%node/moderation"] = array(
    'title' => 'Moderate',
    'description' => 'Show the content moderation history.',
    'type' => MENU_LOCAL_TASK,
    'page callback' => 'workbench_moderation_node_history_view',
    'page arguments' => array(
      1,
    ),
    'access callback' => '_workbench_moderation_access',
    'access arguments' => array(
      'view history',
      1,
    ),
    'file' => 'workbench_moderation.node.inc',
  );

  // Unpublishing a live revision.
  $items["node/%node/moderation/%/unpublish"] = array(
    'title' => 'Unpublish revision',
    'description' => 'Unpublish the current live revision.',
    'type' => MENU_CALLBACK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'workbench_moderation_node_unpublish_form',
      1,
    ),
    'load arguments' => array(
      3,
    ),
    'access callback' => '_workbench_moderation_access',
    'access arguments' => array(
      'unpublish',
      1,
    ),
    'file' => 'workbench_moderation.node.inc',
  );

  // Change the moderation state of a node.
  // Used in workbench_moderation_get_moderation_links()
  $items["node/%node/moderation/%/change-state/%"] = array(
    'title' => 'Change moderation state',
    'page callback' => 'workbench_moderation_moderate_callback',
    'page arguments' => array(
      1,
      5,
    ),
    'load arguments' => array(
      3,
    ),
    'access callback' => '_workbench_moderation_moderate_access',
    'access arguments' => array(
      1,
      5,
    ),
    'type' => MENU_CALLBACK,
  );
  $items['node/%node/moderation/view'] = array(
    'title' => 'Revisions',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );

  // View the current revision of a node. Redirects to node/%node if the current revision is
  // published, and to node/%node/draft if the current revision is a draft.
  $items["node/%node/current-revision"] = array(
    'page callback' => 'workbench_moderation_node_current_view',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'access content',
    ),
    'file' => 'workbench_moderation.node.inc',
  );

  // View the current draft of a node.
  $items["node/%node/draft"] = array(
    'title' => 'View draft',
    'page callback' => 'workbench_moderation_node_view_draft',
    'page arguments' => array(
      1,
    ),
    'access callback' => '_workbench_moderation_access_current_draft',
    'access arguments' => array(
      1,
    ),
    'file' => 'workbench_moderation.node.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => -9,
  );

  // Module settings.
  $items["admin/config/workbench/moderation"] = array(
    'title' => 'Workbench Moderation',
    'description' => 'Configure content moderation.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'workbench_moderation_admin_states_form',
    ),
    'access arguments' => array(
      'administer workbench moderation',
    ),
    'file' => 'workbench_moderation.admin.inc',
  );
  $items['admin/config/workbench/moderation/general'] = array(
    'title' => 'States',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
  );
  $items['admin/config/workbench/moderation/transitions'] = array(
    'title' => 'Transitions',
    'type' => MENU_LOCAL_TASK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'workbench_moderation_admin_transitions_form',
    ),
    'access arguments' => array(
      'administer workbench moderation',
    ),
    'file' => 'workbench_moderation.admin.inc',
  );
  $items['admin/config/workbench/moderation/check-permissions'] = array(
    'title' => 'Check permissions',
    'type' => MENU_LOCAL_TASK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'workbench_moderation_admin_check_role_form',
    ),
    'access arguments' => array(
      'administer workbench moderation',
    ),
    'file' => 'workbench_moderation.admin.inc',
    'weight' => 10,
  );

  // If the diff module is present, replicate its pages under the moderation tab.
  if (module_exists('diff')) {
    $diff_menu_items = diff_menu();
    $items['node/%node/moderation/diff'] = array(
      'type' => MENU_LOCAL_TASK,
      'file path' => drupal_get_path('module', 'diff'),
      'title' => 'Compare revisions',
      'page arguments' => array(
        1,
      ),
    );
    $items['node/%node/moderation/diff'] += $diff_menu_items['node/%node/revisions/list'];
    $items['node/%node/moderation/diff/list'] = array(
      'title' => 'Compare revisions',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -1,
    );
    $items['node/%node/moderation/diff/view'] = array(
      'page arguments' => array(
        1,
        5,
        6,
      ),
      'tab_parent' => 'node/%/moderation/diff/list',
      'file path' => drupal_get_path('module', 'diff'),
    );
    $items['node/%node/moderation/diff/view'] += $diff_menu_items['node/%node/revisions/view'];
  }
  return $items;
}