| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_field_settings_form()
|
| 6 |
* on behalf of core List module.
|
| 7 |
*/
|
| 8 |
function taxonomy_field_settings_form($field, $instance) {
|
| 9 |
// Get the right values for allowed_values_function, which is a core setting.
|
| 10 |
$options = array();
|
| 11 |
$vocabularies = taxonomy_get_vocabularies();
|
| 12 |
foreach ($vocabularies as $vocabulary) {
|
| 13 |
$options[$vocabulary->vid] = $vocabulary->name;
|
| 14 |
}
|
| 15 |
$form['allowed_values'] = array(
|
| 16 |
'#tree' => TRUE,
|
| 17 |
);
|
| 18 |
foreach ($field['settings']['allowed_values'] as $delta => $tree) {
|
| 19 |
$form['allowed_values'][$delta]['vid'] = array(
|
| 20 |
'#type' => 'select',
|
| 21 |
'#title' => t('Vocabulary'),
|
| 22 |
'#default_value' => $tree['vid'],
|
| 23 |
'#options' => $options,
|
| 24 |
'#required' => TRUE,
|
| 25 |
'#description' => t('The vocabulary which supplies the options for this field.'),
|
| 26 |
);
|
| 27 |
$form['allowed_values'][$delta]['parent'] = array(
|
| 28 |
'#type' => 'value',
|
| 29 |
'#value' => $tree['parent'],
|
| 30 |
);
|
| 31 |
}
|
| 32 |
|
| 33 |
return $form;
|
| 34 |
}
|