1 menu.inc _menu_link_build($item)

Builds a link from a router item.

Related topics

File

core/includes/menu.inc, line 2979
API for the Backdrop menu system.

Code

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;
  }

  // Save icon and description to options.
  $options = array();
  if (!empty($item['icon'])) {
    $options['icon'] = $item['icon'];
  }
  if (!empty($item['description'])) {
    $options['attributes']['title'] = $item['description'];
  }

  // 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' => 'internal',
    'link_title' => $item['title'],
    'link_path' => $item['path'],
    'hidden' => 0,
    'options' => $options,
  );
  return $item;
}