function _i18n_init_mode in Internationalization 6
Initialize selection mode
1 call to _i18n_init_mode()
- i18n_init in ./
i18n.module - Implementation of hook_init().
File
- ./
i18n.module, line 68 - Internationalization (i18n) module.
Code
function _i18n_init_mode() {
if (i18n_selection_mode() != 'off') {
// Node language when loading specific nodes or creating translations.
if (arg(0) == 'node') {
// We shouldn't call menu_get_object() because it may end up calling i18n_selection_mode(), see #614548
// Also we better don't do the full node loading here because there may be missing modules (init)
if (is_numeric(arg(1)) && arg(2) == 'edit' && ($lang = i18n_node_get_lang(arg(1)))) {
i18n_selection_mode('node', $lang);
}
elseif (arg(1) == 'add' && !empty($_GET['translation']) && !empty($_GET['language'])) {
i18n_selection_mode('translation', db_escape_string($_GET['language']));
}
}
elseif (arg(0) == 'admin') {
// There are some exceptions for admin pages.
if (arg(1) == 'content' && user_access('administer all languages')) {
// No restrictions for administration pages.
i18n_selection_mode('off');
}
elseif (arg(1) == 'build' && (arg(2) == 'menu-customize' || arg(2) == 'menu')) {
// All nodes available when editing custom menu items.
i18n_selection_mode('off');
}
}
}
}