function taxonomy_menu_menu_link_load in Taxonomy menu 7.2
Loads an existing menu link or creates an initialized one from a taxonomy term.
Parameters
array $term: A taxonomy term to be used to load or create its corresponding menu link.
string $langcode: The language code corresponding to the menu link to be loaded.
Return value
array A menu link corresponding to the taxonomy term.
1 call to taxonomy_menu_menu_link_load()
- taxonomy_menu_menu_link_prepare in ./
taxonomy_menu.module - Prepares a taxonomy item to be saved as a menu link.
File
- ./
taxonomy_menu.module, line 221 - Generates menu links for all selected taxonomy terms.
Code
function taxonomy_menu_menu_link_load($term, $langcode) {
$menu_link = array();
// Try to get an existing menu link, else initialize a new one with the right
// settings.
$mlid = _taxonomy_menu_get_mlid($term->tid, $term->vid, $langcode);
if ($mlid) {
$menu_link = menu_link_load($mlid);
// Flag that we want to update a reference in {taxonomy_menu} table later.
$menu_link['taxonomy_menu']['update'] = TRUE;
}
else {
// Only use the term's weight for menu links to be created, else you will
// reset weights that may have been changed by other processes than
// Taxonomy Menu.
$menu_link['module'] = 'taxonomy_menu';
$menu_link['hidden'] = 0;
$menu_link['weight'] = $term->weight;
$menu_link['has_children'] = 1;
$menu_link['language'] = $langcode;
$menu_link['taxonomy_menu']['update'] = FALSE;
}
return $menu_link;
}