function locale_language_url_rewrite_session
Rewrite URLs for the Session language provider.
Related topics
1 string reference to 'locale_language_url_rewrite_session'
- locale_language_negotiation_info in modules/
locale/ locale.module - Implements hook_language_negotiation_info().
File
-
includes/
locale.inc, line 495
Code
function locale_language_url_rewrite_session(&$path, &$options) {
static $query_rewrite, $query_param, $query_value;
// The following values are not supposed to change during a single page
// request processing.
if (!isset($query_rewrite)) {
global $user;
if (!$user->uid) {
$languages = language_list('enabled');
$languages = $languages[1];
$query_param = check_plain(variable_get('locale_language_negotiation_session_param', 'language'));
$query_value = isset($_GET[$query_param]) ? check_plain($_GET[$query_param]) : NULL;
$query_rewrite = isset($languages[$query_value]) && language_negotiation_get_any(LOCALE_LANGUAGE_NEGOTIATION_SESSION);
}
else {
$query_rewrite = FALSE;
}
}
// If the user is anonymous, the user language provider is enabled, and the
// corresponding option has been set, we must preserve any explicit user
// language preference even with cookies disabled.
if ($query_rewrite) {
if (is_string($options['query'])) {
$options['query'] = drupal_get_query_array($options['query']);
}
if (!isset($options['query'][$query_param])) {
$options['query'][$query_param] = $query_value;
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.