function translation_taxonomy_term_form in Internationalization 5
Same name and namespace in other branches
- 5.3 translation/translation.module \translation_taxonomy_term_form()
- 5.2 translation/translation.module \translation_taxonomy_term_form()
Produces a vocabulary translation form
1 string reference to 'translation_taxonomy_term_form'
- translation_taxonomy_admin in translation/
translation.module - This is the callback for taxonomy translations
File
- translation/
translation.module, line 963
Code
function translation_taxonomy_term_form($vid, $trid = NULL) {
$languages = i18n_supported_languages();
if (!$trid) {
$translations = array();
}
else {
$form['trid'] = array(
'#type' => 'hidden',
'#value' => $trid,
);
$translations = translation_term_get_translations(array(
'trid' => $trid,
));
}
//var_dump($translations);
$vocabulary = taxonomy_get_vocabulary($vid);
// List of terms for languages
foreach ($languages as $lang => $langname) {
$current = isset($translations[$lang]) ? $translations[$lang]->tid : '';
$list = translation_vocabulary_get_terms($vid, $lang, 'all');
$list[''] = '--';
$form[$lang] = array(
'#type' => 'fieldset',
'#tree' => TRUE,
);
$form[$lang]['tid'] = array(
'#type' => 'select',
'#title' => $langname,
'#default_value' => $current,
'#options' => $list,
);
$form[$lang]['old'] = array(
'#type' => 'hidden',
'#value' => $current,
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
$form['#redirect'] = 'admin/content/taxonomy/' . $vid . '/translation';
return $form;
}