summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-01-22 03:18:30 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-01-22 03:18:30 +0000
commitafc9df994a10a2af320f21fe87f47f10315dd28b (patch)
treed58d730b096d406e74bf12c84c22d74c281c536b /includes
parentb4c737a2a5ed9bf9905c91107f94e42df36f2c44 (diff)
downloadbrdo-afc9df994a10a2af320f21fe87f47f10315dd28b.tar.gz
brdo-afc9df994a10a2af320f21fe87f47f10315dd28b.tar.bz2
#220559 by eMPee584 and Damien Tournoud: Fix bug in language switcher block that makes all languages active (with tests)
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc5
-rw-r--r--includes/theme.inc4
2 files changed, 7 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 37a90e10a..8c0dd1311 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1803,6 +1803,8 @@ function drupal_attributes($attributes = array()) {
* an HTML string containing a link to the given path.
*/
function l($text, $path, array $options = array()) {
+ global $language;
+
// Merge in defaults.
$options += array(
'attributes' => array(),
@@ -1810,7 +1812,8 @@ function l($text, $path, array $options = array()) {
);
// Append active class.
- if ($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) {
+ if (($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) &&
+ (empty($options['language']) || $options['language']->language == $language->language)) {
if (isset($options['attributes']['class'])) {
$options['attributes']['class'] .= ' active';
}
diff --git a/includes/theme.inc b/includes/theme.inc
index 9fd7f8b08..855f0ef21 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -1141,6 +1141,7 @@ function theme_status_messages($display = NULL) {
* A string containing an unordered list of links.
*/
function theme_links($links, $attributes = array('class' => 'links')) {
+ global $language;
$output = '';
if (count($links) > 0) {
@@ -1159,7 +1160,8 @@ function theme_links($links, $attributes = array('class' => 'links')) {
if ($i == $num_links) {
$class .= ' last';
}
- if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))) {
+ if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))
+ && (empty($link['language']) || $link['language']->language == $language->language)) {
$class .= ' active';
}
$output .= '<li' . drupal_attributes(array('class' => $class)) . '>';