You are here

function apachesolr_menu in Apache Solr Search 8

Same name and namespace in other branches
  1. 5.2 apachesolr.module \apachesolr_menu()
  2. 5 apachesolr.module \apachesolr_menu()
  3. 6.3 apachesolr.module \apachesolr_menu()
  4. 6 apachesolr.module \apachesolr_menu()
  5. 6.2 apachesolr.module \apachesolr_menu()
  6. 7 apachesolr.module \apachesolr_menu()

Implements hook_menu().

File

./apachesolr.module, line 25
Integration with the Apache Solr search application.

Code

function apachesolr_menu() {
  $items = array();
  $items['admin/config/search/apachesolr'] = array(
    'title' => 'Apache Solr search',
    'description' => 'Administer Apache Solr.',
    'page callback' => 'apachesolr_status_page',
    'access arguments' => array(
      'administer search',
    ),
    'weight' => -8,
    'file' => 'apachesolr.admin.inc',
  );
  $items['admin/config/search/apachesolr/index'] = array(
    'title' => 'Default index',
    'description' => 'Administer Apache Solr.',
    'page callback' => 'apachesolr_status_page',
    'access arguments' => array(
      'administer search',
    ),
    'weight' => -8,
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/config/search/apachesolr/settings'] = array(
    'title' => 'Settings',
    'weight' => 10,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_settings',
    ),
    'access arguments' => array(
      'administer search',
    ),
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $settings_path = 'admin/config/search/apachesolr/settings/';
  $items[$settings_path . '%apachesolr_environment/index'] = array(
    'title' => 'Index',
    'page callback' => 'apachesolr_status_page',
    'page arguments' => array(
      5,
    ),
    'access arguments' => array(
      'administer search',
    ),
    'weight' => 0,
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $items[$settings_path . '%apachesolr_environment/index/remaining'] = array(
    'title' => 'Remaining',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_index_action_form_remaining_confirm',
      5,
    ),
    'file' => 'apachesolr.admin.inc',
    'access arguments' => array(
      'administer search',
    ),
    'type' => MENU_CALLBACK,
  );
  $items[$settings_path . '%apachesolr_environment/index/delete'] = array(
    'title' => 'Reindex',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_index_action_form_delete_confirm',
      5,
    ),
    'file' => 'apachesolr.admin.inc',
    'access arguments' => array(
      'administer search',
    ),
    'type' => MENU_CALLBACK,
  );
  $items[$settings_path . '%apachesolr_environment/index/reset'] = array(
    'title' => 'Reindex',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_index_action_form_reset_confirm',
      5,
    ),
    'file' => 'apachesolr.admin.inc',
    'access arguments' => array(
      'administer search',
    ),
    'type' => MENU_CALLBACK,
  );
  $items[$settings_path . '%apachesolr_environment/index/reset/confirm'] = array(
    'title' => 'Confirm the re-indexing of all content',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_clear_index_confirm',
      5,
    ),
    'access arguments' => array(
      'administer search',
    ),
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items[$settings_path . '%apachesolr_environment/index/delete/confirm'] = array(
    'title' => 'Confirm index deletion',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_delete_index_confirm',
      5,
    ),
    'access arguments' => array(
      'administer search',
    ),
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items[$settings_path . '%apachesolr_environment/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_environment_edit_form',
      5,
    ),
    'description' => 'Edit Apache Solr search environment.',
    'access arguments' => array(
      'administer search',
    ),
    'weight' => 10,
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $items[$settings_path . '%apachesolr_environment/clone'] = array(
    'title' => 'Apache Solr search environment clone',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_environment_clone_form',
      5,
    ),
    'access arguments' => array(
      'administer search',
    ),
    'file' => 'apachesolr.admin.inc',
  );
  $items[$settings_path . '%apachesolr_environment/delete'] = array(
    'title' => 'Apache Solr search environment delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_environment_delete_form',
      5,
    ),
    'access callback' => 'apachesolr_environment_delete_page_access',
    'access arguments' => array(
      'administer search',
      5,
    ),
    'file' => 'apachesolr.admin.inc',
  );
  $items[$settings_path . 'add'] = array(
    'title' => 'Add search environment',
    'description' => 'Add Apache Solr environment.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_environment_edit_form',
    ),
    'access arguments' => array(
      'administer search',
    ),
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_LOCAL_ACTION,
  );
  $items['admin/config/search/apachesolr/index/confirm/clear'] = array(
    'title' => 'Confirm the re-indexing of all content',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_clear_index_confirm',
    ),
    'access arguments' => array(
      'administer search',
    ),
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $items['admin/config/search/apachesolr/index/confirm/delete'] = array(
    'title' => 'Confirm index deletion',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'apachesolr_delete_index_confirm',
    ),
    'access arguments' => array(
      'administer search',
    ),
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_CALLBACK,
  );
  $reports_path = 'admin/reports/apachesolr';
  $items[$reports_path] = array(
    'title' => 'Apache Solr search index',
    'description' => 'Information about the contents of the index on the server',
    'page callback' => 'apachesolr_index_report',
    'access arguments' => array(
      'access site reports',
    ),
    'file' => 'apachesolr.admin.inc',
  );
  $items[$reports_path . '/%apachesolr_environment'] = array(
    'title' => 'Apache Solr search index',
    'description' => 'Information about the contents of the index on the server',
    'page callback' => 'apachesolr_index_report',
    'page arguments' => array(
      3,
    ),
    'access arguments' => array(
      'access site reports',
    ),
    'file' => 'apachesolr.admin.inc',
  );
  $items[$reports_path . '/%apachesolr_environment/index'] = array(
    'title' => 'Search index',
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items[$reports_path . '/%apachesolr_environment/conf'] = array(
    'title' => 'Configuration files',
    'page callback' => 'apachesolr_config_files_overview',
    'access arguments' => array(
      'access site reports',
    ),
    'file' => 'apachesolr.admin.inc',
    'weight' => 5,
    'type' => MENU_LOCAL_TASK,
  );
  $items[$reports_path . '/%apachesolr_environment/conf/%'] = array(
    'title' => 'Configuration file',
    'page callback' => 'apachesolr_config_file',
    'page arguments' => array(
      5,
      3,
    ),
    'access arguments' => array(
      'access site reports',
    ),
    'file' => 'apachesolr.admin.inc',
    'type' => MENU_CALLBACK,
  );
  if (module_exists('devel')) {
    $items['node/%node/devel/apachesolr'] = array(
      'title' => 'Apache Solr',
      'page callback' => 'apachesolr_devel',
      'page arguments' => array(
        1,
      ),
      'access arguments' => array(
        'access devel information',
      ),
      'file' => 'apachesolr.admin.inc',
      'type' => MENU_LOCAL_TASK,
    );
  }

  // We handle our own menu paths for facets
  if (module_exists('facetapi')) {
    $file_path = drupal_get_path('module', 'facetapi');
    $first = TRUE;
    foreach (facetapi_get_realm_info() as $realm_name => $realm) {
      if ($first) {
        $first = FALSE;
        $items[$settings_path . '%apachesolr_environment/facets'] = array(
          'title' => 'Facets',
          'page callback' => 'apachesolr_enabled_facets_page',
          'page arguments' => array(
            $realm_name,
            5,
          ),
          'weight' => -5,
          'access arguments' => array(
            'administer search',
          ),
          'file path' => $file_path,
          'file' => 'facetapi.admin.inc',
          'type' => MENU_LOCAL_TASK,
          'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
        );
      }
      else {
        $items[$settings_path . '%apachesolr_environment/facets/' . $realm_name] = array(
          'title' => $realm['label'],
          'page callback' => 'apachesolr_enabled_facets_page',
          'page arguments' => array(
            $realm_name,
            5,
          ),
          'weight' => -5,
          'access arguments' => array(
            'administer search',
          ),
          'type' => MENU_LOCAL_TASK,
          'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
          'file path' => $file_path,
          'file' => 'facetapi.admin.inc',
        );
      }
    }
  }
  return $items;
}