You are here

function finder_menu in Finder 7

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

Implements hook_menu().

See also

hook_menu()

File

./finder.module, line 17
The finder module.

Code

function finder_menu() {
  $items = array();
  $items['finder_ajax'] = array(
    'title' => 'Finder Ajax',
    'page callback' => 'finder_ajax',
    '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/structure/finder'] = $admin_item + array(
    'title' => 'Finder',
    'page callback' => 'finder_admin_list',
    'access arguments' => array(
      'administer finder',
    ),
    'weight' => 0,
    'type' => MENU_NORMAL_ITEM,
    'description' => 'Finders are configurable forms to allow users to find objects in the system.',
  );
  $items['admin/structure/finder/list'] = $admin_item + array(
    'title' => 'Finder list',
    'weight' => 1,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/structure/finder/import'] = $admin_item + array(
    'title' => 'Import finder',
    'page callback' => 'finder_admin_import',
    'access arguments' => array(
      'administer finder',
    ),
    'weight' => 2,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/structure/finder/%finder'] = $admin_item + array(
    'title' => 'Edit finder',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'finder_admin_edit',
      3,
    ),
    'access arguments' => array(
      'administer finder',
    ),
    'weight' => 3,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/structure/finder/%finder/edit'] = $admin_item + array(
    'title' => 'Finder settings',
    'weight' => 3,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/structure/finder/%finder/delete'] = $admin_item + array(
    'title' => 'Delete finder',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'finder_admin_delete',
      3,
    ),
    'access arguments' => array(
      'administer finder',
    ),
    'weight' => 4,
    'type' => MENU_CALLBACK,
  );
  $items['admin/structure/finder/%finder/export'] = $admin_item + array(
    'title' => 'Export finder',
    'page callback' => 'finder_admin_export',
    'page arguments' => array(
      3,
    ),
    'access arguments' => array(
      'administer finder',
    ),
    'weight' => 5,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/structure/finder/%finder/%finder_arg_optional'] = $admin_item + array(
    'title' => 'Finder element settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'finder_admin_element_edit',
      3,
      4,
    ),
    'access arguments' => array(
      4,
    ),
    'access callback' => 'finder_menu_element_allowed',
    'weight' => 6,
    'type' => MENU_LOCAL_TASK,
  );
  $items['admin/structure/finder/%finder/%finder_arg_optional/delete'] = $admin_item + array(
    'title' => 'Delete element',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'finder_admin_element_delete',
      3,
      4,
    ),
    'access arguments' => array(
      'administer finder',
    ),
    'weight' => 7,
    'type' => MENU_CALLBACK,
  );
  $items['admin/structure/finder/custom_matching'] = $admin_item + array(
    'title' => 'Finder custom matching',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'finder_admin_custom_matching',
    ),
    'access arguments' => array(
      'administer finder',
    ),
    'weight' => 8,
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}