function _lexicon_page in Lexicon 7
Lexicon page callback function.
1 string reference to '_lexicon_page'
- lexicon_menu in ./
lexicon.module - Implements hook_menu().
File
- includes/
lexicon.pages.inc, line 10 - Page callbacks for the Lexicon module
Code
function _lexicon_page($letter = NULL) {
$found_vid = NULL;
$curr_path = $_GET['q'];
$scroll_enabled = variable_get('lexicon_local_links_scroll', 0);
$path = drupal_get_path('module', 'lexicon');
// Add the JavaScript required for the scroll effect if enabled.
if ($scroll_enabled == 1) {
drupal_add_js($path . '/js/jquery.scrollTo-min.js');
drupal_add_js($path . '/js/jquery.localscroll-min.js');
drupal_add_js($path . '/js/lexicon.js');
}
$vids = variable_get('lexicon_vids', array());
// Get the vocabulary-id for the vocabulary which the page callback is called
// for by comparing the current path to the path that is configured for each
// Lexicon.
foreach ($vids as $vid) {
$tmp_path = variable_get('lexicon_path_' . $vid, 'lexicon/' . $vid);
if (strpos($curr_path, $tmp_path) !== FALSE) {
$found_vid = $vid;
}
}
// Check the argument and derive the letter from it if it is correct.
if ($letter != NULL) {
if (drupal_strlen($letter) != 8 || drupal_substr($letter, 0, 7) != 'letter_') {
return MENU_NOT_FOUND;
}
else {
$letter = drupal_substr($letter, 7, 1);
}
}
$voc = taxonomy_vocabulary_load($found_vid);
// Set the active menu to be "primary-links" to make the breadcrumb work.
// By default the active menu would be "navigation", causing only
// "Home" > $node->title to be shown.
menu_set_active_menu_names('primary-links');
return _lexicon_overview($voc, $letter);
}