Return to Snippet

Revision: 4178
at November 1, 2007 21:43 by WimLeers


Initial Code
function vocabulary_to_options($vid) {
  $tree = taxonomy_get_tree($vid);
  if ($tree) {
      foreach ($tree as $term) {
        $choice = new stdClass();
        $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
        $options[] = $choice;
    }
  }
  return $options;
}

Initial URL


Initial Description


Initial Title
vocabulary to options

Initial Tags
drupal

Initial Language
PHP