function _menu_firstchild_get_firstchild_href in Menu Firstchild 7
Same name and namespace in other branches
- 6 menu_firstchild.module \_menu_firstchild_get_firstchild_href()
1 call to _menu_firstchild_get_firstchild_href()
- menu_firstchild_translated_menu_link_alter in ./
menu_firstchild.module - Implementation of hook_translated_menu_link_alter().
File
- ./
menu_firstchild.module, line 58 - menu_firstchild.module Main file for the menu_firstchild module.
Code
function _menu_firstchild_get_firstchild_href($mlid) {
global $language;
$result = db_query('SELECT mlid, link_path FROM {menu_links} WHERE plid = :plid ORDER BY weight, link_title', array(
':plid' => $mlid,
));
foreach ($result as $m) {
if ($m->link_path != '<firstchild>') {
$child = menu_link_load($m->mlid);
if (!empty($child['access']) && empty($child['hidden']) && (!isset($child['localized_options']['langcode']) || $child['localized_options']['langcode'] == $language->language)) {
return $m->link_path;
}
}
else {
$href = _menu_firstchild_get_firstchild_href($m->mlid);
if ($href != NULL) {
return $href;
}
}
}
return NULL;
}