menu_link_load

6 menu.inc menu_link_load($mlid)
7 menu.inc menu_link_load($mlid)
8 menu.inc 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

3 calls to menu_link_load()

File

includes/menu.inc, line 1653
API for the Drupal menu system.

Code

function menu_link_load($mlid) {
  if (is_numeric($mlid) && $item = db_fetch_array(db_query("SELECT m.*, ml.* FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path WHERE ml.mlid = %d", $mlid))) {
    _menu_link_translate($item);
    return $item;
  }
  return FALSE;
}

Comments

to render

use the menu_item_link theme to turn it into a link ( that theme uses l() )

<?php
$link
= menu_link_load($mlid);
$html = theme('menu_item_link',$link);
?>

more here: http://api.drupal.org/api/drupal/includes--menu.inc/function/theme_menu_...

Login or register to post comments