You are here

function bootstrap_menu_items_link in Bootstrap menu items 7.3

Same name and namespace in other branches
  1. 7 bootstrap_menu_items.module \bootstrap_menu_items_link()

Override of theme_link().

This function will render link if it is "header" or "separator". Otherwise it will call originally overwritten menu_item_link function.

1 string reference to 'bootstrap_menu_items_link'
bootstrap_menu_items_theme_registry_alter in ./bootstrap_menu_items.module
Implements hook_theme_registry_alter().

File

./bootstrap_menu_items.module, line 84
Drupal Module: Bootstrap menu items.

Code

function bootstrap_menu_items_link(array $variables) {
  $paths = array(
    '<nolink>',
    '<header>',
    '<separator>',
  );
  if (in_array($variables['path'], $paths)) {
    switch ($variables['path']) {
      case '<nolink>':

        // Set empty fragment '#' as link.
        $variables['options']['attributes']['class'][] = 'nolink';
        $variables['options']['external'] = TRUE;
        $variables['options']['fragment'] = FALSE;
        $link = l($variables['text'], NULL, $variables['options']);
        break;
      case '<header>':
        $link = check_plain($variables['text']);
        break;
      case '<separator>':

        // Empty "menu link title" may confuse users in menu administration.
        // The text is hidden, so no problem.
        $link = check_plain($variables['text']);
        break;
    }
    return $link;
  }

  // Call the original theme function for normal menu link.
  return theme('bootstrap_menu_items_link_default', $variables);
}