function glossary_overview in Glossary 5.2
Same name and namespace in other branches
- 5 glossary.module \glossary_overview()
- 6 glossary.module \glossary_overview()
- 7 glossary.module \glossary_overview()
1 call to glossary_overview()
File
- ./
glossary.module, line 815 - Glossary terms will be automatically marked with links to their descriptions.
Code
function glossary_overview($vocab) {
if (func_num_args() < 2) {
$letter = NULL;
}
else {
$letter = func_get_arg(1);
}
$dest = drupal_get_destination();
$tbl = get_html_translation_table(HTML_SPECIALCHARS);
$tbl[' '] = '_';
$output = '<div id="' . strtr(drupal_strtolower($vocab->name), $tbl) . '">';
if ($vocab->description) {
$output .= '<p class="glossary-description">' . $vocab->description . '</p>';
}
$vid = $vocab->vid;
if ($letter) {
$letter = drupal_substr($letter, 6, 1, 'UTF-8');
drupal_set_title(t('Glossary beginning with !let', array(
'!let' => drupal_strtoupper($letter),
)));
}
$current_let = '';
$no_overview = variable_get('glossary_click_option', 0) == 0 && variable_get('glossary_page_per_letter', FALSE) == TRUE;
$show_desc = variable_get('glossary_show_description', FALSE);
$separate = variable_get('glossary_separate_letters', FALSE);
$tree = taxonomy_get_tree($vid);
$synonyms = _glossary_get_synonyms($vid);
$output .= _glossary_alphabar($vid, $tree);
$output .= '<div class="glossary-list">' . "\n";
$output .= '<dl>' . "\n";
if ($tree) {
foreach ($tree as $term) {
$term->synonyms = $synonyms[$term->tid];
// See if it's a new section.
// If we're looking for a single letter, see if this is it.
if (!$no_overview && !$letter || $term->let == $letter) {
// See if it's a new section.
if ($term->let != $current_let) {
$current_let = $term->let;
$output .= "\n" . '<a id="letter' . $term->let . '"></a>';
if ($separate) {
$output .= '<div class="glossary-letter">' . $term->let . '</div>';
}
}
$output .= theme('glossary_overview_item', $term, $show_desc, $dest);
}
}
}
$output .= '</dl></div></div>';
return glossary_admin_links($vocab, $dest) . $output;
}