menu_link_load

Versions
6 – 7
menu_link_load($mlid)

Get a menu link by its mlid, access checked and link translated for rendering.

This function should never be called from within node_load() or any other function used as a menu object load function since an infinite recursion may occur.

Parameters

$mlid The mlid of the menu item.

Return value

A menu link, with $item['access'] filled and link translated for rendering.

Related topics

▾ 4 functions call menu_link_load()

menu_edit_menu_submit in modules/menu/menu.admin.inc
Submit function for adding or editing a custom menu.
menu_node_prepare in modules/menu/menu.module
Implement hook_node_prepare().
shortcut_set_customize_submit in modules/shortcut/shortcut.admin.inc
Submit handler for the shortcut set customization form.
_menu_delete_item in includes/menu.inc
Helper function for menu_link_delete; deletes a single menu link.

Code

includes/menu.inc, line 2158

<?php
function menu_link_load($mlid) {
  if (is_numeric($mlid)) {
    $query = db_select('menu_links', 'ml');
    $query->leftJoin('menu_router', 'm', 'm.path = ml.router_path');
    $query->fields('ml');
    $query->fields('m');
    $query->condition('ml.mlid', $mlid);
    if ($item = $query->execute()->fetchAssoc()) {
      _menu_link_translate($item);
      return $item;
    }
  }
  return FALSE;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.