function taxonomy_unique_form_taxonomy_form_vocabulary_alter in Taxonomy unique 7
Implements hook_form_FORM_ID_alter() for taxonomy_form_vocabulary().
File
- ./
taxonomy_unique.module, line 14 - Module file for the Taxonomy unique module.
Code
function taxonomy_unique_form_taxonomy_form_vocabulary_alter(&$form, &$form_state, $form_id) {
$form['unique_container'] = array(
'#type' => 'fieldset',
'#title' => t('Taxonomy unique'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['unique_container']['unique'] = array(
'#type' => 'checkbox',
'#title' => t('Terms should be unique.'),
'#default_value' => variable_get('taxonomy_unique_' . $form['#vocabulary']->machine_name, ''),
);
$form['unique_container']['unique_message'] = array(
'#type' => 'textfield',
'#title' => t('Message to show if term already exists'),
'#description' => t('Placeholders: %term and %vocabulary'),
'#default_value' => variable_get('taxonomy_unique_' . $form['#vocabulary']->machine_name . '_message', TAXONOMY_UNIQUE_DEFAULT_MESSAGE),
);
// Attach custom submit handler to the form.
$form['#submit'][] = 'taxonomy_unique_taxonomy_form_vocabulary_submit';
}