You are here

function search_api_facetapi_menu in Search API 7

Implements hook_menu().

File

contrib/search_api_facetapi/search_api_facetapi.module, line 11
Integrates the Search API with the Facet API.

Code

function search_api_facetapi_menu() {

  // We need to handle our own menu paths for facets because we need a facet
  // configuration page per index.
  $first = TRUE;
  foreach (facetapi_get_realm_info() as $realm_name => $realm) {
    if ($first) {
      $first = FALSE;
      $items['admin/config/search/search_api/index/%search_api_index/facets'] = array(
        'title' => 'Facets',
        'page callback' => 'search_api_facetapi_settings',
        'page arguments' => array(
          $realm_name,
          5,
        ),
        'weight' => -1,
        'access arguments' => array(
          'administer search_api',
        ),
        'type' => MENU_LOCAL_TASK,
        'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
      );
      $items['admin/config/search/search_api/index/%search_api_index/facets/' . $realm_name] = array(
        'title' => $realm['label'],
        'type' => MENU_DEFAULT_LOCAL_TASK,
        'weight' => $realm['weight'],
      );
    }
    else {
      $items['admin/config/search/search_api/index/%search_api_index/facets/' . $realm_name] = array(
        'title' => $realm['label'],
        'page callback' => 'search_api_facetapi_settings',
        'page arguments' => array(
          $realm_name,
          5,
        ),
        'access arguments' => array(
          'administer search_api',
        ),
        'type' => MENU_LOCAL_TASK,
        'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
        'weight' => $realm['weight'],
      );
    }
  }
  return $items;
}