function facetapi_menu in Facet API 7
Same name and namespace in other branches
- 6.3 facetapi.module \facetapi_menu()
- 6 facetapi.module \facetapi_menu()
- 7.2 facetapi.module \facetapi_menu()
Implements hook_menu().
File
- ./
facetapi.module, line 115 - An abstracted facet API that can be used by various search backends.
Code
function facetapi_menu() {
$items = array();
// Builds the realm settings forms for each searcher.
foreach (facetapi_get_searcher_info() as $searcher => $searcher_info) {
// Only build router items automatically if a path is provided.
if (empty($searcher_info['path'])) {
continue;
}
// Builds realm settings.
$first = TRUE;
foreach (facetapi_get_realm_info() as $realm_name => $realm) {
if ($first) {
$first = FALSE;
// Add the first realm as a default local task.
$items[$searcher_info['path'] . '/facets'] = array(
'title' => 'Facets',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'facetapi_realm_settings_form',
$searcher,
$realm_name,
),
'access callback' => 'facetapi_access_callback',
'type' => MENU_LOCAL_TASK,
'file' => 'facetapi.admin.inc',
);
$items[$searcher_info['path'] . '/facets/' . $realm_name] = array(
'title' => $realm['label'],
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => $realm['weight'],
);
}
else {
// Add all additional realms as local tasks.
$items[$searcher_info['path'] . '/facets/' . $realm_name] = array(
'title' => $realm['label'],
'page callback' => 'drupal_get_form',
'page arguments' => array(
'facetapi_realm_settings_form',
$searcher,
$realm_name,
),
'access callback' => 'facetapi_access_callback',
'type' => MENU_LOCAL_TASK,
'file' => 'facetapi.admin.inc',
);
}
}
}
$items['admin/config/search/facetapi/%facetapi_adapter/%facetapi_realm/%facetapi_facet/edit'] = array(
'title' => 'Configure facet display',
'load arguments' => array(
4,
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'facetapi_facet_display_form',
4,
5,
6,
),
'access callback' => 'facetapi_access_callback',
'type' => MENU_LOCAL_ACTION,
'context' => MENU_CONTEXT_INLINE,
'weight' => -15,
'file' => 'facetapi.admin.inc',
);
$items['admin/config/search/facetapi/%facetapi_adapter/%facetapi_realm/%facetapi_dependencies/dependencies'] = array(
'title' => 'Configure facet dependencies',
'load arguments' => array(
4,
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'facetapi_facet_dependencies_form',
4,
5,
6,
),
'access callback' => 'facetapi_access_callback',
'type' => MENU_LOCAL_ACTION,
'context' => MENU_CONTEXT_INLINE,
'weight' => -10,
'file' => 'facetapi.admin.inc',
);
$items['admin/config/search/facetapi/%facetapi_adapter/%facetapi_realm/%facetapi_filters/filters'] = array(
'title' => 'Configure facet filters',
'load arguments' => array(
4,
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'facetapi_facet_filters_form',
4,
5,
6,
),
'access callback' => 'facetapi_access_callback',
'type' => MENU_LOCAL_ACTION,
'context' => MENU_CONTEXT_INLINE,
'weight' => -5,
'file' => 'facetapi.admin.inc',
);
$items['admin/config/search/facetapi/%facetapi_adapter/%facetapi_realm/%facetapi_facet/export'] = array(
'title' => 'Export facet configuration',
'load arguments' => array(
4,
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'facetapi_export_form',
4,
5,
6,
),
'access callback' => 'facetapi_access_callback',
'type' => MENU_NORMAL_ITEM,
'file' => 'facetapi.admin.inc',
);
$items['admin/config/search/facetapi/%facetapi_adapter/%facetapi_realm/%facetapi_facet/revert'] = array(
'title' => 'Revert facet configuration',
'load arguments' => array(
4,
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'facetapi_revert_form',
4,
5,
6,
),
'access callback' => 'facetapi_access_callback',
'type' => MENU_NORMAL_ITEM,
'file' => 'facetapi.admin.inc',
);
return $items;
}