function taxonomy_field_info

Implements hook_field_info().

Field settings:

  • allowed_values: a list array of one or more vocabulary trees:

    • vocabulary: a vocabulary machine name.
    • parent: a term ID of a term whose children are allowed. This should be '0' if all terms in a vocabulary are allowed. The allowed values do not include the parent term.

File

modules/taxonomy/taxonomy.module, line 1447

Code

function taxonomy_field_info() {
    return array(
        'taxonomy_term_reference' => array(
            'label' => t('Term reference'),
            'description' => t('This field stores a reference to a taxonomy term.'),
            'default_widget' => 'options_select',
            'default_formatter' => 'taxonomy_term_reference_link',
            'settings' => array(
                'allowed_values' => array(
                    array(
                        'vocabulary' => '',
                        'parent' => '0',
                    ),
                ),
            ),
        ),
    );
}

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