You are here

function theme_superfish_menu_item in Superfish 7

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

Returns HTML for a menu item.

Parameters

array $variables: An associative array containing:

  • element: Structured array data for a menu item.
  • properties: Various properties of a menu item.

Return value

string HTML string

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 2449
Enables the use of jQuery Superfish plugin for Drupal menus.

Code

function theme_superfish_menu_item(array $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] : '';
  if ($properties['use_link_theme']) {
    $link_variables = array(
      'menu_item' => $element['item'],
      'link_options' => $element['item']['link']['localized_options'],
    );
    $output .= theme('superfish_menu_item_link', $link_variables);
  }
  else {
    $output .= l($element['item']['link']['title'], $element['item']['link']['href'], $element['item']['link']['localized_options']);
  }
  $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;
}