function admin_language_preprocess_toolbar in Administration Language 7
Implements hook_preprocess_toolbar().
File
- ./
admin_language.module, line 310 - Makes admin pages be displayed in the administrator's preferred language.
Code
function admin_language_preprocess_toolbar(&$variables) {
global $language, $_admin_language;
if (variable_get('admin_language_translate_toolbar', 0)) {
// Save the current language and activate the administration language...
$current_language = $language;
$language = $_admin_language;
// ...rebuild the toolbar...
$toolbar = toolbar_view();
$variables['toolbar'] = array_merge($variables['toolbar'], $toolbar);
// ...and the shortcuts...
if (module_exists('shortcut')) {
$shortcut_set = shortcut_current_displayed_set();
menu_cache_clear($shortcut_set->set_name);
$shortcuts = shortcut_renderable_links();
foreach (element_children($variables['toolbar']['toolbar_drawer'][0]['shortcuts']) as $index) {
if (!empty($shortcuts[$index])) {
$variables['toolbar']['toolbar_drawer'][0]['shortcuts'][$index] = $shortcuts[$index];
}
}
$variables['toolbar']['toolbar_drawer'][0]['configure']['#title'] = t('Edit shortcuts');
}
// ...and restore the previous language
$language = $current_language;
}
}