You are here

function search_by_page_menu in Search by Page 7

Same name and namespace in other branches
  1. 8 search_by_page.module \search_by_page_menu()
  2. 6 search_by_page.module \search_by_page_menu()

Implements hook_menu().

File

./search_by_page.module, line 909
Main module file for Drupal module Search by Page.

Code

function search_by_page_menu() {
  $items = array();
  $items['admin/config/search/search_by_page'] = array(
    'title' => 'Search by Page settings',
    'description' => 'Configure settings for Search by Page',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'search_by_page_admin_overview',
    ),
    'access arguments' => array(
      'administer search by page',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/config/search/search_by_page/resetblank'] = array(
    'title' => 'Search by Page reset blank',
    'description' => 'Reset unindexed pages for Search by Page',
    'page callback' => 'search_by_page_reset_blank',
    'access arguments' => array(
      'administer search by page',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/config/search/search_by_page/edit/%'] = array(
    'title' => 'Search by Page environment settings',
    'description' => 'Configure settings for Search by Page environment',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'search_by_page_admin_settings',
      5,
    ),
    'access arguments' => array(
      'administer search by page',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/config/search/search_by_page/edit/%/general'] = array(
    'title' => 'General settings',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['admin/config/search/search_by_page/add'] = array(
    'title' => 'Add environment',
    'type' => MENU_CALLBACK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'search_by_page_admin_settings',
    ),
    'access arguments' => array(
      'administer search by page',
    ),
  );
  $items['admin/config/search/search_by_page/delete'] = array(
    'title' => 'Delete path',
    'type' => MENU_CALLBACK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'search_by_page_delete_confirm',
    ),
    'access arguments' => array(
      'administer search by page',
    ),
  );
  $envs = search_by_page_list_environments();
  foreach ($envs as $envid) {
    $path = search_by_page_setting_get('page_path', $envid, 'search_pages');
    $title = search_by_page_setting_get('page_title', $envid, t('Search'));
    if (module_exists('i18n_string')) {
      $title = i18n_string_translate('search_by_page:search_form:page_title' . $envid, $title);
    }
    $items[$path] = array(
      'title' => $title,
      'page callback' => '_search_by_page_view',
      // Note that 'env' . $envid is used here to avoid argument substitution.
      'page arguments' => array(
        'env' . $envid,
      ),
      'access arguments' => array(
        'search page environment ' . search_by_page_setting_get('environment_name', $envid, t('new')),
      ),
      'type' => MENU_SUGGESTED_ITEM,
    );
  }
  return $items;
}