24 October 2014

This is how you can load menu items children. Also the example / snippet is about how you can get the first child, but the menu has to be in a single language tough. It takes access and being hidden in consideration.

Source code viewer
  1. $mlid = 80085;
  2. $result = db_query('SELECT mlid, link_path FROM {menu_links} WHERE plid = :plid ORDER BY weight, link_title', array(':plid' => $mlid));
  3. $href = FALSE;
  4. foreach ($result as $m) {
  5. $child = menu_link_load($m->mlid);
  6. if (!empty($child['access']) && empty($child['hidden'])) {
  7. $href = $m->link_path;
  8. break;
  9. }
  10. }
  11.  
  12. if ($href) {
  13. dpm($href);
  14. }
Programming Language: PHP