You are here

function theme_jquerymenu_listitem in JQuery menu 7.4

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

Render a list item containing one or more links.

1 theme call to theme_jquerymenu_listitem()
recursive_link_creator in ./jquerymenu.module

File

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

Code

function theme_jquerymenu_listitem($variables) {
  $item = $variables['item'];
  $title = $variables['title'];
  $path = $variables['path'];
  $options = $variables['options'];
  $state = $variables['state'];
  $classes = $variables['classes'];
  $nextlevel = $variables['nextlevel'];
  $has_children = $variables["has_children"];
  $edit_path = $variables["edit_path"];
  $edit_text = $variables["edit_text"];
  $edit_access = $variables["edit_access"];
  if (!isset($output)) {
    $output = '';
  }
  $output .= '<li ' . (variable_get('jquerymenu_insert_list_item_id', 0) ? 'id="jquerymenu-' . $id . '" ' : '') . (empty($classes) ? '>' : ' class="' . implode(' ', $classes) . '">');
  $output .= theme('jquerymenu_links', array(
    'title' => $item['link']['title'],
    'path' => $path,
    'options' => $options,
    'state' => $state,
    'classes' => $classes,
    'has_children' => $item['link']['has_children'],
    'edit_path' => $edit_path,
    'edit_text' => $edit_text,
    'edit_access' => $edit_access,
  ));
  if (!empty($item['link']['has_children'])) {
    if (!empty($nextlevel)) {
      $output .= '<ul>';

      // If the link has children call the function on itself.
      $output .= $nextlevel;
      $output .= '</ul>';
    }
  }
  $output .= '</li>';
  return $output;
}