taxonomy_allowed_values

Versions
7
taxonomy_allowed_values($field)

Create an array of the allowed values for this field.

Call the field's allowed_values function to retrieve the allowed values array.

See also

_taxonomy_term_select()

Code

modules/taxonomy/taxonomy.module, line 1118

<?php
function taxonomy_allowed_values($field) {
  $options = array();
  foreach ($field['settings']['allowed_values'] as $tree) {
    $terms = taxonomy_get_tree($tree['vid'], $tree['parent']);
    if ($terms) {
      foreach ($terms as $term) {
        $options[$term->tid] = str_repeat('-', $term->depth) . $term->name;
      }
    }
  }
  return $options;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.