Skip to content

Commit f618df9

Browse files
committed
Merge pull request #134 from jpstrikesback/7.x-3.x
Sort dropdown caret
2 parents 99880b3 + 51ea06d commit f618df9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

includes/menu.inc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ function kalatheme_links__system_main_menu($variables) {
121121
if (!empty($link['#below'])) {
122122
$class[] = 'dropdown';
123123
$class[] = 'clearfix';
124+
// print a toggle.
125+
$link['#options']['attributes']['role'] = array("button");
126+
$link['#options']['attributes']['class'] += array("dropdown-toggle");
127+
$link['#options']['attributes']['id'] = "main-menu-dropdown-" . $i;
128+
$link['#options']['attributes']['data-toggle'] = array("dropdown");
129+
$link['#options']['attributes']['aria-haspopup'] = array("true");
130+
$link['#options']['html'] = true;
131+
$link['#title'] .= '<span class="caret" aria-hidden="true"></span>';
124132
}
125133
$output .= '<li' . drupal_attributes(array('class' => $class, 'role' =>'presentation')) . '>';
126134

@@ -141,12 +149,11 @@ function kalatheme_links__system_main_menu($variables) {
141149
}
142150

143151
$clearfix = '';
144-
// If link has child items, print a toggle and dropdown menu.
152+
// If link has child items, print a dropdown menu.
145153
if (!empty($link['#below'])) {
146154
$dropdown_id = 'main-menu-dropdown-' . $i;
147-
$output .= '<a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown" id="' . $dropdown_id. '" aria-haspopup="true">';
148155
//Add in text to be available for AT
149-
$output .= '<span class="element-invisible">Toggle submenu for ' . $link['#title'] . '</span><span class="caret" aria-hidden="true"></span></a>';
156+
$output .= '<span class="element-invisible">Toggle submenu for ' . strip_tags($link['#title']) . '</span></a>';
150157
$output .= theme('links__system_main_menu', array(
151158
'links' => $link['#below'],
152159
'attributes' => array(

0 commit comments

Comments
 (0)