function taxonomy_field_settings_form

Implements hook_field_settings_form().

File

modules/taxonomy/taxonomy.module, line 1804

Code

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->machine_name] = $vocabulary->name;
    }
    $form['allowed_values'] = array(
        '#tree' => TRUE,
    );
    foreach ($field['settings']['allowed_values'] as $delta => $tree) {
        $form['allowed_values'][$delta]['vocabulary'] = array(
            '#type' => 'select',
            '#title' => t('Vocabulary'),
            '#default_value' => $tree['vocabulary'],
            '#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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.