function glossary_menu in Glossary 5.2
Same name and namespace in other branches
- 5 glossary.module \glossary_menu()
- 6 glossary.module \glossary_menu()
- 7 glossary.module \glossary_menu()
Implementation of hook_menu().
File
- ./
glossary.module, line 182 - Glossary terms will be automatically marked with links to their descriptions.
Code
function glossary_menu($may_cache) {
if ($may_cache) {
$items[] = array(
'path' => 'glossary/search',
'title' => t('Glossary Search'),
'callback' => 'glossary_search_results',
'access' => user_access('access glossary'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'glossary/clearcache',
'title' => t('Glossary'),
'callback' => 'glossary_clearcache',
'access' => user_access('administer filters'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'glossary',
'title' => t('Glossary'),
'callback' => 'glossary_page',
'access' => user_access('access glossary'),
'type' => MENU_SUGGESTED_ITEM,
);
$items[] = array(
'path' => 'admin/settings/glossary',
'title' => t('Glossary Settings'),
'callback' => 'glossary_settings_page',
'description' => t('Select how you want the Glossary module to behave.'),
'access' => user_access('administer filters'),
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'admin/settings/glossary/general',
'title' => t('General'),
'description' => t('General settings'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'glossary_general_settings_form',
),
'access' => user_access('administer filters'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -3,
);
$items[] = array(
'path' => 'admin/settings/glossary/alphabet',
'title' => t('Alphabet'),
'access' => user_access('administer filters'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'glossary_alphabet_form',
),
'description' => t('Alphabet settings.'),
'type' => MENU_LOCAL_TASK,
'weight' => 0,
);
$items[] = array(
'path' => 'admin/settings/glossary/clearcache',
'title' => t('Clear cache'),
'access' => user_access('administer filters'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'glossary_clearcache_form',
),
'description' => t('Clear the filter cache.'),
'type' => MENU_LOCAL_TASK,
'weight' => 0,
);
}
else {
drupal_add_css(drupal_get_path('module', 'glossary') . '/glossary.css');
$result = db_query('SELECT format, name FROM {filter_formats}');
$countem = db_query("SELECT format, COUNT(delta) as count FROM {filters} WHERE module='glossary' GROUP BY format");
while ($row = db_fetch_array($countem)) {
$enabled[$row['format']] = $row['count'];
}
while ($filter = db_fetch_array($result)) {
$f = $filter['format'];
$n = $filter['name'];
if ($enabled[$f] || !variable_get('glossary_hide_menus', FALSE)) {
$items[] = array(
'path' => 'admin/settings/glossary/filter/' . $f,
'title' => $n,
'access' => user_access('administer filters'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'glossary_filter_form',
$f,
),
'description' => t('Settings for the !name input format.', array(
'!name' => $n,
)),
'weight' => 2,
'type' => MENU_LOCAL_TASK,
);
}
}
if (arg(2)) {
$items[] = array(
'path' => 'glossary/term/' . arg(2),
'title' => t('Glossary'),
'callback' => 'glossary_term',
'callback arguments' => array(
arg(2),
),
'access' => user_access('access glossary'),
'type' => MENU_CALLBACK,
);
}
}
return $items;
}