You are here

function finder_menu in Finder 6

Same name and namespace in other branches
  1. 7.2 finder.module \finder_menu()
  2. 7 finder.module \finder_menu()

Implementation of hook_menu().

See also

hook_menu()

File

./finder.module, line 16
The finder module.

Code

function finder_menu() {
  $items = array();
  $items['finder/finder_ahah'] = array(
    'title' => 'Finder AHAH',
    'page callback' => 'finder_ahah',
    'access arguments' => array(
      'use finder',
    ),
    'type' => MENU_CALLBACK,
  );
  $finders = finder_load_multiple(NULL, array(), TRUE);
  if (is_array($finders)) {
    foreach ($finders as $finder) {
      $items[$finder->path] = array(
        'title' => $finder->title,
        'page callback' => 'finder_page',
        'page arguments' => array(
          $finder->finder_id,
        ),
        'access arguments' => array(
          'use finder',
        ),
        'type' => MENU_CALLBACK,
        'description' => $finder->description,
      );
    }
  }
  $admin_item = array(
    'file' => 'finder.admin.inc',
    'file path' => finder_inc_path(),
  );
  $items['admin/build/finder'] = $admin_item + array(
    'title' => t('Finder'),
    'page callback' => 'finder_admin_list',
    'access arguments' => array(
      'administer finder',
    ),
    'weight' => 0,
    'type' => MENU_NORMAL_ITEM,
    'description' => t("Finders are configurable forms to allow users to find objects in the system."),
  );
  $items['admin/build/finder/list'] = $admin_item + array(
    'title' => t('Finder list'),
    'page callback' => 'finder_admin_list_redirect',
    'access arguments' => array(
      'administer finder',
    ),
    'weight' => 1,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/build/finder/import'] = $admin_item + array(
    'title' => t('Finder import'),
    'page callback' => 'finder_admin_import',
    'access callback' => 'finder_menu_allow_finder_import',
    'weight' => 2,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/build/finder/%finder/edit'] = $admin_item + array(
    'title' => t('Edit finder'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'finder_admin_edit',
      3,
    ),
    'access callback' => 'finder_menu_allow_finder_tabs',
    'access arguments' => array(
      3,
    ),
    'weight' => 3,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/build/finder/%finder/delete'] = $admin_item + array(
    'title' => t('Delete finder'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'finder_admin_delete',
      3,
    ),
    'access callback' => 'finder_menu_allow_finder_tabs',
    'access arguments' => array(
      3,
    ),
    'weight' => 4,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/build/finder/%finder/export'] = $admin_item + array(
    'title' => t('Export finder'),
    'page callback' => 'finder_admin_export',
    'page arguments' => array(
      3,
    ),
    'access callback' => 'finder_menu_allow_finder_tabs',
    'access arguments' => array(
      3,
    ),
    'weight' => 5,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/build/finder/%finder/edit/%/edit'] = $admin_item + array(
    'title' => t('Edit element'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'finder_admin_element_edit',
      3,
      5,
    ),
    'access callback' => 'finder_menu_allow_finder_element_tabs',
    'access arguments' => array(
      3,
    ),
    'weight' => 6,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/build/finder/%finder/edit/%/delete'] = $admin_item + array(
    'title' => t('Delete element'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'finder_admin_element_delete',
      3,
      5,
    ),
    'access callback' => 'finder_menu_allow_finder_element_tabs',
    'access arguments' => array(
      3,
    ),
    'weight' => 7,
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}