taxonomy_field_settings_form
- Versions
- 7
taxonomy_field_settings_form($field, $instance, $has_data)
Implement hook_field_settings_form().
Code
modules/taxonomy/taxonomy.module, line 1294
<?php
function taxonomy_field_settings_form($field, $instance, $has_data) {
// Get proper values for 'allowed_values_function', which is a core setting.
$vocabularies = taxonomy_get_vocabularies();
$options = array();
foreach ($vocabularies as $vocabulary) {
$options[$vocabulary->vid] = $vocabulary->name;
}
$form['allowed_values'] = array(
'#tree' => TRUE,
);
foreach ($field['settings']['allowed_values'] as $delta => $tree) {
$form['allowed_values'][$delta]['vid'] = array(
'#type' => 'select',
'#title' => t('Vocabulary'),
'#default_value' => $tree['vid'],
'#options' => $options,
'#required' => TRUE,
'#description' => t('The vocabulary which supplies the options for this field.'),
'#disabled' => $has_data,
);
$form['allowed_values'][$delta]['parent'] = array(
'#type' => 'value',
'#value' => $tree['parent'],
);
}
return $form;
}
?>Login or register to post comments 