' . drupal_render($element['#below']) . ''; // Generate as standard dropdown. $element['#title'] .= ' '; $element['#attributes']['class'][] = 'dropdown'; $element['#localized_options']['html'] = TRUE; // Set dropdown trigger element to # to prevent inadvertant page loading // when a submenu link is clicked. $element['#localized_options']['attributes']['data-target'] = '#'; $element['#localized_options']['attributes']['class'][] = 'dropdown-toggle'; $element['#localized_options']['attributes']['data-toggle'] = 'dropdown'; } } // On primary navigation menu, class 'active' is not set on active menu item. // @see https://drupal.org/node/1896674 if (($element['#href'] == $_GET['q'] || ($element['#href'] == '' && drupal_is_front_page())) && (empty($element['#localized_options']['language']))) { $element['#attributes']['class'][] = 'active'; } $output = l($element['#title'], $element['#href'], $element['#localized_options']); return '' . $output . $sub_menu . "\n"; } /** * Overrides theme_menu_link() for book module. */ function bootstrap_menu_link__book_toc(array $variables) { $element = $variables['element']; $sub_menu = drupal_render($element['#below']); $element['#attributes']['role'] = 'presentation'; $link = TRUE; if ($element['#title'] && $element['#href'] === FALSE) { $element['#attributes']['class'][] = 'dropdown-header'; $link = FALSE; } elseif ($element['#title'] === FALSE && $element['#href'] === FALSE) { $element['#attributes']['class'][] = 'divider'; $link = FALSE; } elseif (($element['#href'] == $_GET['q'] || ($element['#href'] == '' && drupal_is_front_page())) && (empty($element['#localized_options']['language']))) { $element['#attributes']['class'][] = 'active'; } if ($link) { $element['#title'] = l($element['#title'], $element['#href'], $element['#localized_options']); } return '' . $element['#title'] . $sub_menu . "\n"; }