You are here

function crumbs_menu in Crumbs, the Breadcrumbs suite 7.2

Same name and namespace in other branches
  1. 6.2 crumbs.module \crumbs_menu()
  2. 6 crumbs.module \crumbs_menu()
  3. 7 crumbs.module \crumbs_menu()

Implements hook_menu().

File

./crumbs.info.inc, line 17

Code

function crumbs_menu() {
  $base = 'admin/structure/crumbs';
  $items = array();
  $items[$base] = array(
    'title' => 'Crumbs',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'crumbs_admin_weights_form',
    ),
    'access arguments' => array(
      'administer crumbs',
    ),
    'file' => 'admin/crumbs.admin.inc',
  );
  $items["{$base}/weights"] = array(
    'title' => 'Plugin weights',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items["{$base}/display"] = array(
    'title' => 'Display',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'crumbs_admin_display_form',
    ),
    'access arguments' => array(
      'administer crumbs',
    ),
    'file' => 'admin/crumbs.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 0,
  );
  $items["{$base}/entity-parent"] = array(
    'title' => 'Entity parent',
    'weight' => 10,
    'type' => MENU_LOCAL_TASK,
  );
  $items["{$base}/debug"] = array(
    'title' => 'Debug',
    'page callback' => 'crumbs_debug_page',
    'access arguments' => array(
      'administer crumbs',
    ),
    'file' => 'admin/crumbs.debug.inc',
    'weight' => 20,
    'type' => MENU_LOCAL_TASK,
  );
  if (module_exists('devel')) {
    $items["{$base}/debug/plugins"] = array(
      'title' => 'Plugin results',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items["{$base}/debug/devel"] = array(
      'title' => 'Devel',
      'page callback' => '_crumbs_debug_devel_page',
      'access callback' => '_crumbs_user_access_and',
      'access arguments' => array(
        array(
          'administer crumbs',
          'access devel information',
        ),
      ),
      'file' => 'admin/crumbs.debug.inc',
      'type' => MENU_LOCAL_TASK,
    );
  }
  foreach (array(
    'node' => 'Node',
    'taxonomy_term' => module_exists('taxonomy') ? 'Taxonomy' : FALSE,
    'user' => 'User',
  ) as $entity_type => $title) {
    if (FALSE !== $title) {
      $entity_slug = str_replace('_', '-', $entity_type);
      $items["{$base}/entity-parent/{$entity_slug}"] = array(
        'title' => $title,
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'crumbs_admin_entity_parent_form',
          $entity_type,
        ),
        'access arguments' => array(
          'administer crumbs',
        ),
        'file' => 'admin/crumbs.entity_parent.inc',
        'type' => MENU_LOCAL_TASK,
      );
    }
  }
  $items["{$base}/entity-parent"] += $items["{$base}/entity-parent/node"];
  $items["{$base}/entity-parent/node"] = array(
    'title' => 'Node',
    'weight' => -10,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  if (module_exists('menu')) {

    // Placeholder route for <nolink> items from special_menu_items module.

    /* @see menu_link_load() */
    $items['crumbs/special-menu-item/%menu_link'] = array(
      'access callback' => TRUE,
      /* @see crumbs_special_menu_link_page() */
      'page callback' => 'crumbs_special_menu_link_page',
      'page arguments' => array(
        2,
      ),
      /* @see crumbs_special_menu_link_title() */
      'title callback' => 'crumbs_special_menu_link_title',
      'title arguments' => array(
        2,
      ),
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}