Commit 5395f208 authored by Gábor Hojtsy's avatar Gábor Hojtsy

#194743 by myself, reported and tested by Murz: the base URL was not properly...

#194743 by myself, reported and tested by Murz: the base URL was not properly modified for outgoing links to different language domains and path aliases were not handled in the target language
parent a35fb53e
...@@ -1285,7 +1285,11 @@ function url($path = NULL, $options = array()) { ...@@ -1285,7 +1285,11 @@ function url($path = NULL, $options = array()) {
$clean_url = (bool)variable_get('clean_url', '0'); $clean_url = (bool)variable_get('clean_url', '0');
} }
$base = $options['absolute'] ? $base_url .'/' : base_path(); if (!isset($options['base_url'])) {
// The base_url might be rewritten from the language rewrite in domain mode.
$options['base_url'] = $base_url;
}
$base = $options['absolute'] ? $options['base_url'] .'/' : base_path();
// Preserve the original path before aliasing. // Preserve the original path before aliasing.
$original_path = $path; $original_path = $path;
...@@ -1293,7 +1297,7 @@ function url($path = NULL, $options = array()) { ...@@ -1293,7 +1297,7 @@ function url($path = NULL, $options = array()) {
// The special path '<front>' links to the default front page. // The special path '<front>' links to the default front page.
if (!empty($path) && $path != '<front>') { if (!empty($path) && $path != '<front>') {
if (!$options['alias']) { if (!$options['alias']) {
$path = drupal_get_path_alias($path); $path = drupal_get_path_alias($path, isset($options['langcode']) ? $options['langcode'] : '');
} }
if (function_exists('custom_url_rewrite_outbound')) { if (function_exists('custom_url_rewrite_outbound')) {
// Modules may alter outbound links by reference. // Modules may alter outbound links by reference.
......
...@@ -111,8 +111,11 @@ function language_url_rewrite(&$path, &$options) { ...@@ -111,8 +111,11 @@ function language_url_rewrite(&$path, &$options) {
case LANGUAGE_NEGOTIATION_DOMAIN: case LANGUAGE_NEGOTIATION_DOMAIN:
if ($path_language->domain) { if ($path_language->domain) {
$options['external'] = TRUE; // Ask for an absolute URL with our modified base_url.
$path = $path_language->domain .'/'. $path; $options['absolute'] = TRUE;
$options['base_url'] = $path_language->domain;
// Ensure that path alias generation will use this language.
$options['langcode'] = $path_language->language;
} }
break; break;
...@@ -125,11 +128,8 @@ function language_url_rewrite(&$path, &$options) { ...@@ -125,11 +128,8 @@ function language_url_rewrite(&$path, &$options) {
case LANGUAGE_NEGOTIATION_PATH: case LANGUAGE_NEGOTIATION_PATH:
if (isset($path_language->prefix) && $path_language->prefix) { if (isset($path_language->prefix) && $path_language->prefix) {
// Get alias if not already aliased. // Ensure that path alias generation will use this language.
if (!$options['alias']) { $options['langcode'] = $path_language->language;
$path = drupal_get_path_alias($path, $path_language->language);
$options['alias'] = TRUE;
}
$path = (empty($path) || ($path == '<front>')) ? $path_language->prefix : $path_language->prefix .'/'. $path; $path = (empty($path) || ($path == '<front>')) ? $path_language->prefix : $path_language->prefix .'/'. $path;
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment