You are here

function _menu_firstchild_get_firstchild_href in Menu Firstchild 6

Same name and namespace in other branches
  1. 7 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 66
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 = %d ORDER BY weight, link_title", $mlid);
  while ($m = db_fetch_array($result)) {
    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;
}