translation_node_validate
function translation_node_validate
translation_node_validate($node, $form)
Implements hook_node_validate().
Ensures that duplicate translations can't be created for the same source.
File
- modules/translation/translation.module, line 402
- Manages content translations.
Code
function translation_node_validate($node, $form) { // Only act on translatable nodes with a tnid or translation_source. if (translation_supported_type($node->type) && (!empty($node->tnid) || !empty($form['#node']->translation_source->nid))) { $tnid = !empty($node->tnid) ? $node->tnid : $form['#node']->translation_source->nid; $translations = translation_node_get_translations($tnid); $langcode = entity_language('node', $node); if (isset($translations[$langcode]) && $translations[$langcode]->nid != $node->nid) { form_set_error('language', t('There is already a translation in this language.')); } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!translation!translation.module/function/translation_node_validate/7.x