taxonomy_node_form

Definition

taxonomy_node_form($type, $node = '', $help = NULL, $name = 'taxonomy')
modules/taxonomy.module, line 440

Description

Generate a form for selecting terms to associate with a node.

Code

<?php
function taxonomy_node_form($type, $node = '', $help = NULL, $name = 'taxonomy') {
  if (!$node->taxonomy) {
    if ($node->nid) {
      $terms = array_keys(taxonomy_node_get_terms($node->nid));
    }
    else {
      $terms = 0;
    }
  }
  else {
    $terms = $node->taxonomy;
  }

  $c = db_query("SELECT v.*, n.type FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", $type);
  while ($vocabulary = db_fetch_object($c)) {
    $result[] = taxonomy_form($vocabulary->vid, $terms, $help, $name);
  }
  return $result ? $result : array();
}
?>
 
 

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.