function locale_language_switcher_session
7.x locale.inc | locale_language_switcher_session($type, $path) |
Return the session language switcher block.
Related topics
1 string reference to 'locale_language_switcher_session'
- locale_language_negotiation_info in drupal-7.x/
modules/ locale/ locale.module - Implements hook_language_negotiation_info().
File
- drupal-7.x/
includes/ locale.inc, line 377 - Administration functions for locale.module.
Code
function locale_language_switcher_session($type, $path) {
drupal_add_css(drupal_get_path('module', 'locale') . '/locale.css');
$param = variable_get('locale_language_negotiation_session_param', 'language');
$language_query = isset($_SESSION[$param]) ? $_SESSION[$param] : $GLOBALS[$type]->language;
$languages = language_list('enabled');
$links = array();
$query = $_GET;
unset($query['q']);
foreach ($languages[1] as $language) {
$langcode = $language->language;
$links[$langcode] = array(
'href' => $path,
'title' => $language->native,
'attributes' => array('class' => array('language-link')),
'query' => $query,
);
if ($language_query != $langcode) {
$links[$langcode]['query'][$param] = $langcode;
}
else {
$links[$langcode]['attributes']['class'][] = ' session-active';
}
}
return $links;
}