You are here

function fac_menu in Fast Autocomplete 7

Implements hook_menu().

File

./fac.module, line 13
This file contains the main functions of the Fast Autocomplete module.

Code

function fac_menu() {

  // The browser requests a json file with results from the public files folder.
  // If the file does not exist, Drupal kicks in and a page callback is fired
  // that generates the json file in the public files folder and returns the
  // json result.
  $include_path = drupal_get_path('module', 'fac') . '/inc';
  $fac_file_path = variable_get('file_public_path', conf_path() . '/files') . '/fac-json/';
  $part_count = substr_count($fac_file_path, '/') + 2;
  foreach (array_keys(language_list()) as $language) {
    $file_path = $fac_file_path . $language . '/%/%';
    $items[$file_path] = array(
      'title' => 'Generate Fast Autocomplete JSON',
      'page callback' => 'fac_generate_json',
      'page arguments' => array(
        $language,
        $part_count,
      ),
      'access arguments' => array(
        'access content',
      ),
      'type' => MENU_CALLBACK,
      'file' => 'fac.json.inc',
      'file path' => $include_path,
    );
  }
  $items['admin/config/search/fac'] = array(
    'title' => 'Fast Autocomplete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fac_settings_form',
    ),
    'access arguments' => array(
      'administer fac settings',
    ),
    'type' => MENU_NORMAL_ITEM,
    'description' => 'Configure the Fast Autocomplete module',
    'file' => 'fac.admin.inc',
    'file path' => drupal_get_path('module', 'fac') . '/inc',
  );
  $items['admin/config/search/fac/general'] = array(
    'title' => 'General settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fac_settings_form',
    ),
    'access arguments' => array(
      'administer fac settings',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'file' => 'fac.admin.inc',
    'file path' => drupal_get_path('module', 'fac') . '/inc',
  );
  $items['admin/config/search/fac/backend'] = array(
    'title' => 'Backend settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fac_backend_settings_form',
    ),
    'access arguments' => array(
      'administer fac settings',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'fac.admin.inc',
    'file path' => drupal_get_path('module', 'fac') . '/inc',
    'weight' => 5,
  );
  $items['admin/config/search/fac/delete'] = array(
    'title' => 'Delete json files',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'fac_delete_form',
    ),
    'access arguments' => array(
      'administer fac settings',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'fac.admin.inc',
    'file path' => drupal_get_path('module', 'fac') . '/inc',
    'weight' => 10,
  );
  return $items;
}