You are here

function theme_admin_menu_item in Administration menu 5.2

Same name and namespace in other branches
  1. 5.3 admin_menu.module \theme_admin_menu_item()
  2. 5 admin_menu.inc \theme_admin_menu_item()
  3. 6 admin_menu.module \theme_admin_menu_item()

Generate the HTML output for a single menu item.

Parameters

int $mid: The menu id of the item.

string $children: A string containing any rendered child items of this menu.

bool $leaf: A boolean indicating whether this menu item is a leaf.

1 call to theme_admin_menu_item()
theme_admin_menu_tree in ./admin_menu.module
Generate the HTML for a menu tree.

File

./admin_menu.module, line 265
Renders a menu tree for administrative purposes as dropdown menu at the top of the window.

Code

function theme_admin_menu_item($mid, $children = '', $leaf = TRUE) {
  static $display_option;
  $_admin_menu = admin_menu_get_menu();
  $item = $_admin_menu[$mid];
  if (!isset($display_option)) {
    $display_option = variable_get('admin_menu_display', 0);
  }

  // Display extra information about menu items if enabled (devel).
  if ($display_option) {
    if ($display_option == 'mid') {
      $item['title'] = $item['title'] . ' (' . $mid . ')';
    }
    else {
      if (isset($item[$display_option])) {
        $item['title'] = $item['title'] . ' (' . $item[$display_option] . ')';
      }
    }
  }
  $class = array();
  if (!$leaf) {
    $class[] = 'expandable';
  }
  if (isset($item['class'])) {
    $class[] = $item['class'];
  }
  $output = '<li' . (!empty($class) ? ' class="' . implode(' ', $class) . '"' : '') . '>';
  $output .= '<a href="' . check_url($item['path']) . '"' . drupal_attributes($item['attributes']) . '>' . filter_xss_admin($item['title']) . '</a>' . $children . '</li>';
  return $output;
}