You are here

function glossary_menu in Glossary 6

Same name and namespace in other branches
  1. 5.2 glossary.module \glossary_menu()
  2. 5 glossary.module \glossary_menu()
  3. 7 glossary.module \glossary_menu()

Implementation of hook_menu().

File

./glossary.module, line 202
Glossary terms will be automatically marked with links to their descriptions.

Code

function glossary_menu() {
  $items['glossary/search'] = array(
    'title' => 'Glossary Search',
    'page callback' => 'glossary_search_results',
    'page arguments' => array(
      2,
    ),
    'access arguments' => array(
      'access glossary',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['glossary/clearcache'] = array(
    'title' => 'Glossary clear cache',
    'page callback' => 'glossary_clearcache',
    'access arguments' => array(
      'administer filters',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['glossary'] = array(
    'title' => 'Glossary',
    'page callback' => 'glossary_page',
    'page arguments' => array(
      1,
      2,
    ),
    'access arguments' => array(
      'access glossary',
    ),
    'type' => MENU_SUGGESTED_ITEM,
  );
  $items['admin/settings/glossary'] = array(
    'title' => 'Glossary Settings',
    'page callback' => 'glossary_settings_page',
    'description' => 'Select how you want the Glossary module to behave.',
    'access arguments' => array(
      'administer filters',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'glossary.admin.inc',
  );
  $items['admin/settings/glossary/general'] = array(
    'title' => 'General',
    'description' => 'General settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'glossary_general_settings_form',
    ),
    'access arguments' => array(
      'administer filters',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -3,
    'file' => 'glossary.admin.inc',
  );
  $items['admin/settings/glossary/alphabet'] = array(
    'title' => 'Alphabet',
    'access arguments' => array(
      'administer filters',
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'glossary_alphabet_form',
    ),
    'description' => 'Alphabet settings.',
    'type' => MENU_LOCAL_TASK,
    'weight' => 0,
    'file' => 'glossary.admin.inc',
  );
  $items['admin/settings/glossary/clearcache'] = array(
    'title' => 'Clear cache',
    'access arguments' => array(
      'administer filters',
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'glossary_clearcache_form',
    ),
    'description' => 'Clear the filter cache.',
    'type' => MENU_LOCAL_TASK,
    'weight' => 0,
    'file' => 'glossary.admin.inc',
  );
  $result = db_query('SELECT format, name FROM {filter_formats}');
  while ($filter = db_fetch_array($result)) {
    $format = $filter['format'];
    $enabled = db_result(db_query("SELECT COUNT(delta) FROM {filters} WHERE format=%d AND module='glossary'", $format));
    if ($enabled || !variable_get('glossary_hide_menus', FALSE)) {
      $name = $filter['name'];
      $items['admin/settings/glossary/filter/' . $format] = array(
        'title' => '!name',
        'title arguments' => array(
          '!name' => $name,
        ),
        'access arguments' => array(
          'administer filters',
        ),
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'glossary_filter_form',
          4,
        ),
        'description' => 'Settings for the !name input format.',
        array(
          '!name' => $name,
        ),
        'weight' => 2,
        'type' => MENU_LOCAL_TASK,
        'file' => 'glossary.admin.inc',
      );
    }
  }
  $items['glossary/term/%'] = array(
    'title' => 'Glossary',
    'page callback' => 'glossary_term',
    'page arguments' => array(
      2,
    ),
    'access arguments' => array(
      'access glossary',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}