You are here

function redirect_menu in Redirect 7

Same name and namespace in other branches
  1. 7.2 redirect.module \redirect_menu()

Implements hook_menu().

File

./redirect.module, line 102

Code

function redirect_menu() {
  $items['admin/config/search/redirect'] = array(
    'title' => 'URL redirects',
    'description' => 'Redirect users from one URL to another.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redirect_list_form',
    ),
    'access callback' => 'redirect_access',
    'access arguments' => array(
      'list',
      'redirect',
    ),
    'file' => 'redirect.admin.inc',
  );
  $items['admin/config/search/redirect/list'] = array(
    'title' => 'List',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['admin/config/search/redirect/add'] = array(
    'title' => 'Add redirect',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redirect_edit_form',
    ),
    'access callback' => 'redirect_access',
    'access arguments' => array(
      'create',
      'redirect',
    ),
    'file' => 'redirect.admin.inc',
    'type' => MENU_LOCAL_ACTION,
  );
  $items['admin/config/search/redirect/edit/%redirect'] = array(
    'title' => 'Edit redirect',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redirect_edit_form',
      5,
    ),
    'access callback' => 'redirect_access',
    'access arguments' => array(
      'update',
      5,
    ),
    'file' => 'redirect.admin.inc',
  );
  $items['admin/config/search/redirect/delete/%redirect'] = array(
    'title' => 'Delete redirect',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redirect_delete_form',
      5,
    ),
    'access callback' => 'redirect_access',
    'access arguments' => array(
      'delete',
      5,
    ),
    'file' => 'redirect.admin.inc',
  );
  $items['admin/config/search/redirect/settings'] = array(
    'title' => 'Settings',
    'description' => 'Configure behavior for URL redirects.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'redirect_settings_form',
    ),
    'access arguments' => array(
      'administer redirects',
    ),
    'file' => 'redirect.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 50,
  );

  // If the database logging module is enabled, add special 404 listing pages.
  if (module_exists('dblog')) {
    $items['admin/config/search/redirect/404'] = array(
      'title' => 'Add redirects for 404 pages.',
      'description' => 'Add redirects for 404 pages.',
      'page callback' => 'redirect_404_list',
      'access arguments' => array(
        'administer redirects',
      ),
      'file' => 'redirect.admin.inc',
      'type' => MENU_LOCAL_TASK,
      'weight' => 20,
    );
    $items['admin/reports/page-not-found/redirect'] = array(
      'title' => 'Fix file not found (404) errors with URL redirects',
      'page callback' => 'drupal_goto',
      'page arguments' => array(
        'admin/config/search/redirect/404',
      ),
      'access arguments' => array(
        'administer redirects',
      ),
      'type' => MENU_LOCAL_ACTION,
    );
  }

  // Devel generate integration.
  if (module_exists('devel_generate')) {
    $items['admin/config/development/generate/redirects'] = array(
      'title' => 'Generate redirects',
      'description' => 'Generate a given number of redirects. Optionally delete current redirects.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'redirect_generate_form',
      ),
      'access arguments' => array(
        'administer redirects',
      ),
      'file' => 'redirect.generate.inc',
    );
    $items['admin/config/search/redirect/generate'] = $items['admin/config/development/generate/redirects'];
    $items['admin/config/search/redirect/generate']['type'] = MENU_LOCAL_ACTION;
  }
  return $items;
}