You are here

function theme_menu_item_container in Menu item container 7

Same name and namespace in other branches
  1. 6 menu_item_container.module \theme_menu_item_container()

Generate the HTML output for a menu container's label.

File

./menu_item_container.module, line 158
Provides containers for menu items.

Code

function theme_menu_item_container($link) {
  $options = !empty($link['localized_options']) ? $link['localized_options'] : array();

  // Copied from l() and modified.
  // Merge in defaults.
  $options += array(
    'attributes' => array(),
    'html' => FALSE,
  );

  // Append menu-item-container class.
  if (isset($options['attributes']['class'])) {
    $options['attributes']['class'] .= ' menu-item-container';
  }
  else {
    $options['attributes']['class'] = 'menu-item-container';
  }

  // Make the container navigable with tabindex="0".
  $options['attributes']['tabindex'] = '0';

  // Remove all HTML and PHP tags from a tooltip. For best performance, we act only
  // if a quick strpos() pre-check gave a suspicion (because strip_tags() is expensive).
  if (isset($options['attributes']['title']) && strpos($options['attributes']['title'], '<') !== FALSE) {
    $options['attributes']['title'] = strip_tags($options['attributes']['title']);
  }
  return '<span' . drupal_attributes($options['attributes']) . '>' . ($options['html'] ? $link['title'] : check_plain($link['title'])) . '</span>';
}