You are here

function theme_superfish_menu_item in Superfish 6

Same name and namespace in other branches
  1. 7 superfish.module \theme_superfish_menu_item()

Returns HTML for a menu item.

Parameters

$variables: An associative array containing:

  • element: Structured array data for a menu item.
  • properties: Various properties of a menu item.
1 theme call to theme_superfish_menu_item()
theme_superfish_build in ./superfish.module
Helper function that builds the nested lists of a Superfish menu.

File

./superfish.module, line 1719
Enables the use of jQuery Superfish plugin for Drupal menus.

Code

function theme_superfish_menu_item($variables) {
  $element = $variables['element'];
  $properties = $variables['properties'];
  $sub_menu = '';
  if ($element['below']) {
    $sub_menu .= isset($properties['wrapper']['wul'][0]) ? $properties['wrapper']['wul'][0] : '';
    $sub_menu .= $properties['megamenu']['megamenu_content'] ? '<ol>' : '<ul>';
    $sub_menu .= $element['below'];
    $sub_menu .= $properties['megamenu']['megamenu_content'] ? '</ol>' : '</ul>';
    $sub_menu .= isset($properties['wrapper']['wul'][1]) ? $properties['wrapper']['wul'][1] : '';
  }
  $output = '<li' . drupal_attributes($element['attributes']) . '>';
  $output .= $properties['megamenu']['megamenu_column'] ? '<div class="sf-megamenu-column">' : '';
  $output .= isset($properties['wrapper']['whl'][0]) ? $properties['wrapper']['whl'][0] : '';
  $output .= theme('menu_item_link', $element['item']['link']);
  $output .= isset($properties['wrapper']['whl'][1]) ? $properties['wrapper']['whl'][1] : '';
  $output .= $properties['megamenu']['megamenu_wrapper'] ? '<ul class="sf-megamenu"><li class="sf-megamenu-wrapper ' . $element['attributes']['class'] . '">' : '';
  $output .= $sub_menu;
  $output .= $properties['megamenu']['megamenu_wrapper'] ? '</li></ul>' : '';
  $output .= $properties['megamenu']['megamenu_column'] ? '</div>' : '';
  $output .= '</li>';
  return $output;
}