diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 094a339..d5f5a52 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1689,6 +1689,18 @@ function theme_links($variables) { $class[] = 'last'; } + $link_element = array( + '#type' => 'link', + '#title' => $link['title'], + '#options' => array_diff_key($link, drupal_map_assoc(array('title', 'href', 'ajax'))), + ); + + // @todo Reconcile Views usage of 'ajax' as a boolean with the rest of + // core's usage of it as an array. + if (isset($link['ajax']) && is_array($link['ajax'])) { + $link_element['#ajax'] = $link['ajax']; + } + // Handle links. if (isset($link['href'])) { $is_current_path = ($link['href'] == current_path() || ($link['href'] == '' && drupal_is_front_page())); @@ -1696,24 +1708,14 @@ function theme_links($variables) { if ($is_current_path && $is_current_language) { $class[] = 'active'; } - // @todo Reconcile Views usage of 'ajax' as a boolean with the rest of - // core's usage of it as an array. - if (isset($link['ajax']) && is_array($link['ajax'])) { - // To attach Ajax behavior, render a link element, rather than just - // call l(). - $link_element = array( - '#type' => 'link', - '#title' => $link['title'], - '#href' => $link['href'], - '#ajax' => $link['ajax'], - '#options' => array_diff_key($link, drupal_map_assoc(array('title', 'href', 'ajax'))), - ); - $item = drupal_render($link_element); - } - else { - // Pass in $link as $options, they share the same keys. - $item = l($link['title'], $link['href'], $link); - } + + $link_element['#href'] = $link['href']; + $item = drupal_render($link_element); + } + elseif (isset($link['route_name'])) { + $link_element['#route_name'] = $link['route_name']; + $link_element['#route_parameters'] = empty($link['route_parameters']) ? array() : $link['route_parameters']; + $item = drupal_render($link_element); } // Handle title-only text items. else {