You are here

function workbench_menu in Workbench 7

Implements hook_menu().

File

./workbench.module, line 11
Workbench module file for editorial workspaces.

Code

function workbench_menu() {
  $items = array();
  $items['admin/config/workbench'] = array(
    'title' => 'Workbench',
    'description' => 'Workbench',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'administer workbench',
    ),
    'position' => 'right',
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items['admin/workbench'] = array(
    'title' => 'My Workbench',
    'description' => 'My Workbench area',
    'page callback' => 'workbench_content',
    'access arguments' => array(
      'access workbench',
    ),
    'weight' => -20,
    'file' => 'workbench.pages.inc',
  );
  $items['admin/workbench/content'] = array(
    'title' => 'My content',
    'page callback' => 'workbench_content',
    'access arguments' => array(
      'access workbench',
    ),
    'weight' => -20,
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'file' => 'workbench.pages.inc',
  );
  $items['admin/workbench/create'] = array(
    'title' => 'Create content',
    'page callback' => 'workbench_create',
    'access callback' => 'workbench_create_access',
    'weight' => -15,
    'type' => MENU_LOCAL_TASK,
    'file' => 'workbench.pages.inc',
  );

  // Create redirect urls for node add pages.
  // This is helpful for the admin_menu module and could have other uses.
  foreach (node_type_get_types() as $type) {
    $type_url_str = str_replace('_', '-', $type->type);
    $items['admin/workbench/create/node/add/' . $type_url_str] = array(
      'title' => $type->name,
      'title callback' => 'check_plain',
      'page callback' => 'drupal_goto',
      'page arguments' => array(
        'node/add/' . $type_url_str,
      ),
      'access callback' => 'node_access',
      'access arguments' => array(
        'create',
        $type->type,
      ),
      'description' => $type->description,
    );
  }
  return $items;
}