_menu_link_build

  1. drupal
    1. 6
    2. 8
    3. 7
Versions
6 – 8 _menu_link_build($item)

Builds a link from a router item.

Related topics

▾ 2 functions call _menu_link_build()

menu_reset_item in modules/menu/menu.module
Reset a system-defined menu link.
_menu_navigation_links_rebuild in includes/menu.inc
Helper function to build menu links for the items in the menu router.

Code

includes/menu.inc, line 2729

<?php
function _menu_link_build($item) {
  // Suggested items are disabled by default.
  if ($item['type'] == MENU_SUGGESTED_ITEM) {
    $item['hidden'] = 1;
  }
  // Hide all items that are not visible in the tree.
  elseif (!($item['type'] & MENU_VISIBLE_IN_TREE)) {
    $item['hidden'] = -1;
  }
  // Note, we set this as 'system', so that we can be sure to distinguish all
  // the menu links generated automatically from entries in {menu_router}.
  $item['module'] = 'system';
  $item += array(
    'menu_name' => 'navigation', 
    'link_title' => $item['title'], 
    'link_path' => $item['path'], 
    'hidden' => 0, 
    'options' => empty($item['description']) ? array() : array('attributes' => array('title' => $item['description'])),
  );
  return $item;
}
?>