diff --git a/core/lib/Drupal/Core/Utility/LinkGenerator.php b/core/lib/Drupal/Core/Utility/LinkGenerator.php index d9c2e98..d449d7c 100644 --- a/core/lib/Drupal/Core/Utility/LinkGenerator.php +++ b/core/lib/Drupal/Core/Utility/LinkGenerator.php @@ -119,7 +119,10 @@ public function generate($text, $route_name, array $parameters = array(), array // URL path and query string as the current page. Note that this may be // removed from l() in https://drupal.org/node/1979468 and would be removed // or altered here also. - $variables['url_is_active'] = $this->isRouteActive($route_name, $full_parameters, $variables); + $variables['url_is_active'] = $route_name == $this->active['route_name'] + // The language of an active link is equal to the current language. + && (empty($variables['options']['language']) || $variables['options']['language']->id == $this->active['language']) + && $full_parameters == $this->active['parameters']; // Add the "active" class if appropriate. if ($variables['url_is_active']) { @@ -153,12 +156,10 @@ public function generate($text, $route_name, array $parameters = array(), array * {@inheritdoc} */ public function isRouteActive($route_name, array $route_parameters, array $variables) { - $url_is_active = $route_name == $this->active['route_name'] + return ($route_name == $this->active['route_name']) // The language of an active link is equal to the current language. - && (empty($variables['options']['language']) || $variables['options']['language']->id == $this->active['language']) - && $route_parameters == $this->active['parameters']; - - return $url_is_active; + && (empty($variables['options']['language']) || ($variables['options']['language']->id == $this->active['language'])) + && ($route_parameters == $this->active['parameters']); } }