translation_form_alter(&$form, &$form_state, $form_id)Implements hook_form_alter().
modules/translation/translation.module, line 124
<?php
function translation_form_alter(&$form, &$form_state, $form_id) {
if (!empty($form['#node_edit_form']) && translation_supported_type($form['#node']->type)) {
$node = $form['#node'];
if (!empty($node->translation_source)) {
// We are creating a translation. Add values and lock language field.
$form['translation_source'] = array('#type' => 'value', '#value' => $node->translation_source);
$form['language']['#disabled'] = TRUE;
}
elseif (!empty($node->nid) && !empty($node->tnid)) {
// Disable languages for existing translations, so it is not possible to switch this
// node to some language which is already in the translation set. Also remove the
// language neutral option.
unset($form['language']['#options'][LANGUAGE_NONE]);
foreach (translation_node_get_translations($node->tnid) as $translation) {
if ($translation->nid != $node->nid) {
unset($form['language']['#options'][$translation->language]);
}
}
// Add translation values and workflow options.
$form['tnid'] = array('#type' => 'value', '#value' => $node->tnid);
$form['translation'] = array(
'#type' => 'fieldset',
'#title' => t('Translation settings'),
'#access' => user_access('translate content'),
'#collapsible' => TRUE,
'#collapsed' => !$node->translate,
'#tree' => TRUE,
'#weight' => 30,
);
if ($node->tnid == $node->nid) {
// This is the source node of the translation
$form['translation']['retranslate'] = array(
'#type' => 'checkbox',
'#title' => t('Flag translations as outdated'),
'#default_value' => 0,
'#description' => t('If you made a significant change, which means translations should be updated, you can flag all translations of this post as outdated. This will not change any other property of those posts, like whether they are published or not.'),
);
$form['translation']['status'] = array('#type' => 'value', '#value' => 0);
}
else {
$form['translation']['status'] = array(
'#type' => 'checkbox',
'#title' => t('This translation needs to be updated'),
'#default_value' => $node->translate,
'#description' => t('When this option is checked, this translation needs to be updated because the source post has changed. Uncheck when the translation is up to date again.'),
);
}
}
}
}
?>