menu_item_link

5 menu.inc menu_item_link($mid, $theme = TRUE)

Returns the rendered link to a menu item.

Parameters

$mid: The menu item id to render.

$theme: Whether to return a themed link or the link as an array

Related topics

4 calls to menu_item_link()

File

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

Code

function menu_item_link($mid, $theme = TRUE) {
  $item = menu_get_item($mid);
  $link_item = $item;
  $link = '';

  while ($link_item['type'] & MENU_LINKS_TO_PARENT) {
    $link_item = menu_get_item($link_item['pid']);
  }

  if ($theme) {
    $link = theme('menu_item_link', $item, $link_item);
  }
  else {
    $link = array(
      'title' => $item['title'], 
      'href' => $link_item['path'], 
      'attributes' => !empty($item['description']) ? array('title' => $item['description']) : array(),
    );
  }

  return $link;
}
Login or register to post comments