function _lexicon_get_terms in Lexicon 7
Same name and namespace in other branches
- 6 lexicon.module \_lexicon_get_terms()
Function that returns all Lexicon terms and synonyms from the Lexicon vocabularies indicated by $vids as used by the input filter.
1 call to _lexicon_get_terms()
- _filter_lexicon_process in ./
lexicon.module - Lexicon filter process callback function. Marks terms in the content of the website.
File
- ./
lexicon.module, line 1053 - The Lexicon module is used to create lists of terms and definitions to use on a website and optionally mark those terms in the content of the website.
Code
function _lexicon_get_terms(&$vids) {
static $got = array();
$terms = array();
// If the terms have not been loaded get the tree for each lexicon vocabulary.
if (!$got) {
foreach ($vids as $vid) {
// Load the entire vocabulary with all entities.
if (module_exists('i18n_taxonomy')) {
global $language;
$tree = i18n_taxonomy_get_tree($vid, $language->language, 0, NULL, TRUE);
}
else {
$tree = taxonomy_get_tree($vid, 0, NULL, TRUE);
}
// If the terms are localizable, localize them.
if (function_exists('i18n_taxonomy_localize_terms')) {
$tree = i18n_taxonomy_localize_terms($tree);
}
// Add extra information to each term in the tree.
foreach ($tree as $term) {
_lexicon_term_add_info($term, TRUE);
$terms[] = $term;
}
}
$got = $terms;
}
else {
// Use the already loaded terms.
$terms = $got;
}
return $terms;
}