function entity_translation_form_taxonomy_form_vocabulary_alter in Entity Translation 7
Implements hook_form_FORM_ID_alter()
File
- ./
entity_translation.taxonomy.inc, line 66 - The taxonomy specific translation functions and hook implementations.
Code
function entity_translation_form_taxonomy_form_vocabulary_alter(&$form, &$form_state) {
if (entity_translation_enabled('taxonomy_term')) {
$name = $form_state['vocabulary']->machine_name;
if (isset($form['i18n_translation']['i18n_mode'])) {
$args = array(
'!url' => url('admin/config/regional/entity_translation'),
);
$form['i18n_translation']['i18n_mode']['#options'][I18N_MODE_ENTITY_TRANSLATION] = t('Field translation. Term fields will be translated through the <a href="!url">Entity translation</a> module.', $args);
if (entity_translation_enabled_bundle('taxonomy_term', $name)) {
$form['i18n_translation']['i18n_mode']['#default_value'] = I18N_MODE_ENTITY_TRANSLATION;
}
}
else {
$form['entity_translation_taxonomy'] = array(
'#title' => t('Enable field translation'),
'#type' => 'checkbox',
'#prefix' => '<label>' . t('Translation') . '</label>',
'#default_value' => entity_translation_enabled('taxonomy_term', $name),
);
}
$form['#submit'][] = 'entity_translation_form_taxonomy_form_vocabulary_submit';
}
}