You are here

function theme_jquerymenu_links in JQuery menu 7.4

Same name and namespace in other branches
  1. 7.3 jquerymenu.module \theme_jquerymenu_links()

Render a single link, possibly with open/close link and/or edit button.

1 theme call to theme_jquerymenu_links()
theme_jquerymenu_listitem in ./jquerymenu.module
Render a list item containing one or more links.

File

./jquerymenu.module, line 434
The jQuerymenu module parses hierarchical link arrays and renders them as click and expand menu blocks.

Code

function theme_jquerymenu_links($variables) {

  // create values from the parameter array
  $title = $variables["title"];
  $path = $variables["path"];
  $options = $variables["options"];
  $state = $variables["state"];
  $classes = $variables["classes"];
  $has_children = $variables["has_children"];
  $edit_path = $variables["edit_path"];
  $edit_text = $variables["edit_text"];
  $edit_access = $variables["edit_access"];
  $parentlink = variable_get('jquerymenu_parentlink', 0);
  $output = '';

  // This is the span that becomes the little plus and minus symbol.
  $plus = '<span' . (empty($classes) ? '>' : ' class="' . implode(' ', $classes) . '">') . '</span>';
  $link = l($title, $path, $options);
  if ($edit_path != NULL && user_access($edit_access)) {
    $edit_box = jquerymenu_edit_box($edit_path, $edit_text);
    if ($has_children != 0) {
      $output .= $parentlink ? $edit_box . $plus . $title : $edit_box . $plus . $link;
    }
    else {
      $output .= $edit_box . $link;
    }
  }
  else {
    if ($has_children != 0) {
      $output .= $parentlink ? $plus . $title : $plus . $link;
    }
    else {
      $output .= $link;
    }
  }
  return $output;
}