You are here

function taxonomy_field_info in Drupal 7

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
Enables the organization of content into categories.

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',
          ),
        ),
      ),
    ),
  );
}