You are here

function menu_views_superfish_menu_item_link in Menu Views 8.3

Same name and namespace in other branches
  1. 7.2 menu_views.module \menu_views_superfish_menu_item_link()

Implements theme_superfish_menu_item_link(). Overrides default theming function to intercept views.

1 string reference to 'menu_views_superfish_menu_item_link'
menu_views_theme_registry_alter in ./menu_views.module
Implements hook_theme_registry_alter(). Intercepts theme_menu_link().

File

./menu_views.module, line 97
Module to allow Views to be attached as menu items.

Code

function menu_views_superfish_menu_item_link(array $variables) {
  if (isset($variables['menu_item']['link'])) {

    // Only intercept if this menu item link is a view.
    if ($view = _menu_views_replace_menu_item($variables['menu_item']['link'])) {
      $item = _menu_views_get_item($variables['menu_item']['link']);
      return '<div' . drupal_attributes(array(
        'class' => explode(' ', $item['view']['settings']['wrapper_classes']),
      )) . '>' . $view . '</div>';
    }
    elseif ($variables['menu_item']['link']['link_path'] == '<view>') {
      return '';
    }
  }

  // Otherwise, use the default theming function.
  return theme('menu_views_superfish_menu_item_link_default', $variables);
}