You are here

function taxonomy_tools_publisher_node_insert in Taxonomy Tools 8

Same name and namespace in other branches
  1. 7 taxonomy_tools_publisher/taxonomy_tools_publisher.module \taxonomy_tools_publisher_node_insert()

Implements hook_node_insert().

File

taxonomy_tools_publisher/taxonomy_tools_publisher.module, line 362
Drupal hooks and functions to manipulate taxonomy terms.

Code

function taxonomy_tools_publisher_node_insert($node) {
  $fields = taxonomy_tools_publisher_reference_fields($node->type);

  // Publish taxonomy terms that use this node.
  if (!empty($fields) && $node->status == 1 && variable_get('taxonomy_tools_publisher_automatic_publishing', 0) == 1) {
    foreach ($fields as $field) {
      $terms = $node->{$field}[LANGUAGE_NONE];
      foreach ($terms as $term) {
        taxonomy_tools_publisher_publish_term($term['tid']);
      }
    }
  }
}