function translation_node_form_submit in Internationalization 5
Same name and namespace in other branches
- 5.3 translation/translation.module \translation_node_form_submit()
- 5.2 translation/translation.module \translation_node_form_submit()
Process translation node form
File
- translation/
translation.module, line 772
Code
function translation_node_form_submit($form_id, $form_values) {
$op = $_POST['op'];
$source_nid = $form_values['source_nid'];
$language = $form_values['language'];
if ($form_values['nid']) {
$nid = $form_values['nid'];
}
if ($form_values['lookup'] && ($number = intval($form_values['lookup']))) {
$nid = $number;
}
if ($source_nid && $language && $nid && ($node = node_load($nid)) && $node->language == $language) {
if ($trid = $form_values['trid']) {
// Delete old translations
db_query("UPDATE {i18n_node} SET trid = 0 WHERE trid = %d AND language = '%s'", $trid, $language);
}
else {
$trid = db_next_id('{i18n_node}_trid');
}
db_query("UPDATE {i18n_node} SET trid = %d WHERE nid=%d OR nid=%d", $trid, $source_nid, $nid);
drupal_set_message(t('The translation has been saved'));
}
}