function fp_render_menu_item

6.x theme.inc fp_render_menu_item($item, $bool_check_user_access = TRUE)
4.x theme.inc fp_render_menu_item($item, $bool_check_user_access = TRUE)
5.x theme.inc fp_render_menu_item($item, $bool_check_user_access = TRUE)
1 call to fp_render_menu_item()
fp_render_menu_block in includes/theme.inc
Render a "menu" block of menu items which are all rooted at the menu_root. So if the menu root is tools, it might return items whose paths look like: tools/fun tools/here/there So long as the menu type is "MENU_TYPE_NORMAL_ITEM" or…

File

includes/theme.inc, line 2191

Code

function fp_render_menu_item($item, $bool_check_user_access = TRUE) {
  $rtn = "";

  if ($bool_check_user_access) {
    if (!menu_check_user_access($item)) {
      return "";
    }
  }

  $description = $item ["description"];
  $title = $item ["title"];
  $safe_title = htmlentities(trim($title), ENT_QUOTES);
  //$url = $GLOBALS["fp_system_settings"]["base_path"] . "/" . $item["path"];
  $url = fp_url($item ["path"], "", TRUE);
  $target = @$item ["page_settings"]["target"];
  $menu_icon = @$item ["page_settings"]["menu_icon"];
  $extra_class = "";
  if ($menu_icon != "") {

    if (!strstr($menu_icon, 'http')) {
      $base_url = $GLOBALS ['fp_system_settings']['base_url'];
      if ($base_url == "/") {
        $base_url = ""; // so that we don't have // as a path, because of the next line.
      }

      if (substr($menu_icon, 0, 1) == '/') {
        // Already starts with a slash, so probably should just use as is.
        // take no action.
      }
      else {
        $menu_icon = $base_url . "/" . $menu_icon;
      }
    }
    $icon_img = "<img src='$menu_icon' border='0' class='fpmn-icon' alt='$safe_title'>";
  }
  else {
    $icon_img = "<span class='fp-menu-item-no-icon'></span>";
  }

  if (!$description) {
    $extra_class = "fp-menu-item-tight";
  }


  $machine_title = strtolower(fp_get_machine_readable($title));
  $machine_path = strtolower(fp_get_machine_readable($item ['path']));

  $extra_class .= " fp-menu-item-title-$machine_title fp-menu-item-path-$machine_path ";

  $rtn .= "<div class='fp-menu-item $extra_class'>
            <div class='fp-menu-item-link-line'>
              <a href='$url' target='$target'>$icon_img$title</a>
            </div>
            ";
  if ($description) {
    $rtn .= " <div class='fp-menu-item-description'>$description</div>";
  }
  $rtn .= "</div>";

  return $rtn;
}