function i18n_node_node_prepare in Internationalization 7
Implements hook_node_prepare().
File
- i18n_node/
i18n_node.module, line 222 - Internationalization (i18n) module - Node type handling
Code
function i18n_node_node_prepare($node) {
$options = variable_get('i18n_node_options_' . $node->type, array());
if (i18n_node_type_enabled($node) && empty($node->nid) && !i18n_object_langcode($node) && in_array('current', $options)) {
$default = variable_get('i18n_node_default_language_for_' . $node->type, '-- current --');
// Set current language for new nodes if option enabled
if ($default === '-- current --') {
$node->language = i18n_language_content()->language;
}
else {
$node->language = $default;
}
}
}