function fe_taxonomy_form_alter in Features Extra 6
Implementation of hook_form_alter().
File
- ./
fe_taxonomy.module, line 184
Code
function fe_taxonomy_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'taxonomy_form_vocabulary' && user_access('administer features')) {
// Machine name.
$table = 'fe_taxonomy_vocabulary';
$vid = $form['vid']['#value'];
if (!empty($vid)) {
$machine_name = db_result(db_query("SELECT machine_name FROM {{$table}} WHERE vid = %d", $vid));
}
$form['identification']['machine_name'] = array(
'#type' => 'textfield',
'#title' => t('Machine name'),
'#default_value' => empty($machine_name) ? '' : $machine_name,
'#maxlength' => 32,
'#description' => t('Give the vocabulary a machine name to make it exportable with "!features" module.', array(
'!features' => l('Features', 'http://drupal.org/project/features'),
)),
'#weight' => -2,
);
// Vocabulary module.
$vocab_module = $form['module']['#value'];
$form['identification']['vocab_module'] = array(
'#type' => 'textfield',
'#title' => t('Vocabulary module'),
'#default_value' => empty($vocab_module) ? 'taxonomy' : $vocab_module,
'#maxlength' => 32,
'#description' => t('You can change the vocabulary module so that you can use "!api".', array(
'!api' => l('hook_term_path($term)', 'http://api.drupal.org/api/function/hook_term_path/6'),
)),
'#weight' => -1,
);
// Validate machine name.
$form['#validate'][] = 'fe_taxonomy_machine_name_validate';
}
}