Posted By

WimLeers on 11/01/07


Tagged

drupal taxonomy


Versions (?)

vocabulary to options


 / Published in: PHP
 

  1. function vocabulary_to_options($vid) {
  2. $tree = taxonomy_get_tree($vid);
  3. if ($tree) {
  4. foreach ($tree as $term) {
  5. $choice = new stdClass();
  6. $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
  7. $options[] = $choice;
  8. }
  9. }
  10. return $options;
  11. }

Report this snippet  

You need to login to post a comment.