function i18n_node_language_list in Internationalization 7
Same name and namespace in other branches
- 5.3 i18n.module \i18n_node_language_list()
- 5 i18n.module \i18n_node_language_list()
- 5.2 i18n.module \i18n_node_language_list()
- 6 i18n.module \i18n_node_language_list()
Get allowed languages for node.
This allows node types to define its own language list implementing hook 'language_list'.
Parameters
$node: Node to retrieve language list for.
$translate: Only languages available for translation.
$select: Only languages that can be selected for this node
4 calls to i18n_node_language_list()
- i18n_node_node_view_alter in i18n_node/
i18n_node.module - Implements hook_node_view_alter().
- i18n_node_select_translation in i18n_node/
i18n_node.pages.inc - Form to select existing nodes as translation
- i18n_node_translation_overview in i18n_node/
i18n_node.pages.inc - Overview page for a node's translations.
- _i18n_node_form_node_form_alter in i18n_node/
i18n_node.module - Implements hook_form_BASE_FORM_ID_alter(). Called by i18n_node_form_node_form_alter
File
- i18n_node/
i18n_node.module, line 178 - Internationalization (i18n) module - Node type handling
Code
function i18n_node_language_list($node, $translate = FALSE, $select = FALSE) {
// Check if the node module manages its own language list.
$languages = node_invoke($node, 'language_list', $translate);
if (!$languages) {
$languages = i18n_language_list('name', i18n_node_language_mode($node));
if ($translate && isset($node->tnid) && $node->tnid && ($translations = translation_node_get_translations($node->tnid))) {
unset($translations[$node->language]);
foreach (array_keys($translations) as $langcode) {
unset($languages[$langcode]);
}
}
// Language may be locked for this node type, restrict options to current one
if ($select && i18n_node_language_options($node, 'lock') && !empty($node->language) && !empty($languages[$node->language])) {
$languages = array(
$node->language => $languages[$node->language],
);
}
elseif (!i18n_node_language_options($node, 'required')) {
$languages = array(
LANGUAGE_NONE => t('Language neutral'),
) + $languages;
}
}
return $languages;
}