function i18n_node_select_translation in Internationalization 6
Same name and namespace in other branches
- 7 i18n_node/i18n_node.pages.inc \i18n_node_select_translation()
Form to select existing nodes as translation
This one uses autocomplete fields for all languages
1 string reference to 'i18n_node_select_translation'
- i18n_translation_node_overview in ./
i18n.pages.inc - Overview page for a node's translations.
File
- ./
i18n.pages.inc, line 73 - User page callbacks for the translation module.
Code
function i18n_node_select_translation($form_state, $node, $translations) {
$form['node'] = array(
'#type' => 'value',
'#value' => $node,
);
$form['translations'] = array(
'#type' => 'fieldset',
'#title' => t('Select translations for %title', array(
'%title' => $node->title,
)),
'#tree' => TRUE,
'#theme' => 'i18n_node_select_translation',
'#description' => t("Alternatively, you can select existing nodes as translations of this one or remove nodes from this translation set. Only nodes that have the right language and don't belong to other translation set will be available here."),
);
foreach (language_list() as $language) {
if ($language->language != $node->language) {
$trans_nid = isset($translations[$language->language]) ? $translations[$language->language]->nid : 0;
$form['translations']['nid'][$language->language] = array(
'#type' => 'value',
'#value' => $trans_nid,
);
$form['translations']['language'][$language->language] = array(
'#value' => $language->name,
);
$form['translations']['node'][$language->language] = array(
'#type' => 'textfield',
'#maxlength' => 255,
'#autocomplete_path' => 'i18n/node/autocomplete/' . $node->type . '/' . $language->language,
'#default_value' => $trans_nid ? i18n_node_nid2autocomplete($trans_nid) : '',
);
}
}
$form['buttons']['update'] = array(
'#type' => 'submit',
'#value' => t('Update translations'),
);
//$form['buttons']['clean'] = array('#type' => 'submit', '#value' => t('Delete translation set'));
return $form;
}