function i18n_taxonomy_form_taxonomy_form_vocabulary_alter in Internationalization 7
Implements hook_form_FORM_ID_alter()
File
- i18n_taxonomy/
i18n_taxonomy.module, line 703 - i18n taxonomy module
Code
function i18n_taxonomy_form_taxonomy_form_vocabulary_alter(&$form, &$form_state) {
if (!isset($form_state['confirm_delete'])) {
$vocabulary = $form_state['vocabulary'];
$i18n_mode = i18n_taxonomy_vocabulary_mode($vocabulary);
$langcode = i18n_object_langcode($vocabulary, LANGUAGE_NONE);
// Define the replacement names to add some logic to the translation mode options.
$form += i18n_translation_mode_element('taxonomy_vocabulary', $i18n_mode, $langcode);
if (user_access('translate interface')) {
$form['actions']['translate'] = array(
'#type' => 'submit',
'#name' => 'save_translate',
'#value' => t('Save and translate'),
'#weight' => 5,
'#states' => array(
'invisible' => array(
// Hide the button if language mode is selected value needs to be a
// string so that the javascript-side matching works.
'input[name=i18n_mode]' => array(
'value' => (string) I18N_MODE_LANGUAGE,
),
),
),
);
// Make sure the delete buttons shows up last.
if (isset($form['actions']['delete'])) {
$form['actions']['delete']['#weight'] = 10;
}
}
$form['#validate'][] = 'i18n_taxonomy_form_vocabulary_validate';
$form['#submit'][] = 'i18n_taxonomy_form_vocabulary_submit';
}
}