You are here

function taxonomy_node_validate in Drupal 6

Same name and namespace in other branches
  1. 4 modules/taxonomy.module \taxonomy_node_validate()
  2. 5 modules/taxonomy/taxonomy.module \taxonomy_node_validate()

Make sure incoming vids are free tagging enabled.

1 call to taxonomy_node_validate()
taxonomy_nodeapi in modules/taxonomy/taxonomy.module
Implementation of hook_nodeapi().

File

modules/taxonomy/taxonomy.module, line 652
Enables the organization of content into categories.

Code

function taxonomy_node_validate(&$node) {
  if (!empty($node->taxonomy)) {
    $terms = $node->taxonomy;
    if (!empty($terms['tags'])) {
      foreach ($terms['tags'] as $vid => $vid_value) {
        $vocabulary = taxonomy_vocabulary_load($vid);
        if (empty($vocabulary->tags)) {

          // see form_get_error $key = implode('][', $element['#parents']);
          // on why this is the key
          form_set_error("taxonomy][tags][{$vid}", t('The %name vocabulary can not be modified in this way.', array(
            '%name' => $vocabulary->name,
          )));
        }
      }
    }
  }
}