taxonomy_node_form

Versions
4.6
taxonomy_node_form($type, $node = '', $help = NULL, $name = 'taxonomy')

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

▾ 8 functions call taxonomy_node_form()

blog_form in modules/blog.module
Implementation of hook_form().
book_form in modules/book.module
Implementation of hook_form().
forum_form in modules/forum.module
Implementation of hook_form().
hook_form in developer/hooks/node.php
Display a node editing form.
node_example_form in developer/examples/node_example.module
Implementation of hook_form().
page_form in modules/page.module
Implementation of hook_form().
poll_form in modules/poll.module
Implementation of hook_form().
story_form in modules/story.module
Implementation of hook_form().

Code

modules/taxonomy.module, line 440

<?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();
}
?>
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.