Skip to content

Commit 00b3997

Browse files
author
Josh Walker
committed
Fixing merge conflict
2 parents 417de4b + 8aceb6f commit 00b3997

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

includes/menu.inc

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ function kalatheme_links__system_main_menu($variables) {
138138
if (!empty($val)) {
139139
// Ensure we're not setting empty attributes which is bad for A11Y.
140140
if ($attr == 'class') {
141-
// Note this is assuming class is the only multi-value attribute
142-
// that will come through here. It's probably not fool-proof but
141+
// Note this is assuming class is the only multi-value attribute
142+
// that will come through here. It's probably not fool-proof but
143143
// it is pragmatic.
144144
$val = explode(' ', $val);
145145
$item_attributes[$attr] += $val;
@@ -150,7 +150,7 @@ function kalatheme_links__system_main_menu($variables) {
150150
}
151151
}
152152
}
153-
153+
154154
$output .= '<li' . drupal_attributes($item_attributes) . '>';
155155

156156
if (isset($link['#href'])) {
@@ -198,9 +198,10 @@ function kalatheme_links__system_main_menu($variables) {
198198
}
199199

200200
/**
201-
* Implements theme_menu_link().
201+
* Implements theme_links__system_secondary_menu().
202202
* Added list item attributes. Plays nicely with menu_attributes.module amongst
203203
* other things.
204+
* Implements theme_links__system_secondary_menu.
204205
*/
205206
function kalatheme_links__system_secondary_menu($variables) {
206207
$links = $variables['links'];
@@ -237,33 +238,33 @@ function kalatheme_links__system_secondary_menu($variables) {
237238
foreach ($links as $key => $link) {
238239
$class = array($key);
239240

240-
// Add first, last and active classes to the list of links to help out themers.
241+
// Add first, last and active classes to the list of links to help out
242+
// themers.
241243
if ($i == 1) {
242244
$class[] = 'first';
243245
}
244246
if ($i == $num_links) {
245247
$class[] = 'last';
246248
}
247249
if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))
248-
&& (empty($link['language']) || $link['language']->language == $language_url->language)) {
250+
&& (empty($link['language']) || $link['language']->language == $language_url->language)) {
249251
$class[] = 'active';
250252
}
251-
252-
// Unset any empty attributes.
253-
$link['item_attributes'] = isset($link['item_attributes']) ? array_filter($link['item_attributes']) : array();
254253

255-
// Merge in some extra attributes for the list item.
256-
$extra_item_attributes = array('class' => $class, 'role' =>'presentation');
257-
$link['item_attributes'] = array_merge_recursive($link['item_attributes'], $extra_item_attributes) ;
258-
259-
$output .= '<li' . drupal_attributes($link['item_attributes']) . '>';
254+
$item_attributes = array('class' => $class, 'role' =>'presentation');
255+
if (!empty($link['item_attributes'])) {
256+
$item_attributes = array_merge_recursive($item_attributes, $link['item_attributes']);
257+
}
258+
259+
$output .= '<li' . drupal_attributes($item_attributes) . '>';
260260

261261
if (isset($link['href'])) {
262262
// Pass in $link as $options, they share the same keys.
263263
$output .= l($link['title'], $link['href'], $link);
264264
}
265265
elseif (!empty($link['title'])) {
266-
// Some links are actually not links, but we wrap these in <span> for adding title and class attributes.
266+
// Some links are actually not links, but we wrap these in <span> for
267+
// adding title and class attributes.
267268
if (empty($link['html'])) {
268269
$link['title'] = check_plain($link['title']);
269270
}

0 commit comments

Comments
 (0)