You are here

function node_field_taxonomy_term_delete in Node Field 7.2

Implements hook_taxonomy_term_delete().

File

./node_field.module, line 275
This module provide ability to add extra fields to any single node.

Code

function node_field_taxonomy_term_delete($term) {

  // Delete taxonomy node field values if term was deleted.
  $query_fields = [
    'value' => $term->tid,
    'type' => 'taxonomy',
  ];
  $node_fields = node_field_db_field_select($query_fields);
  foreach ($node_fields as $item) {
    $item['value'] = NULL;
    drupal_alter('node_field_term_default_value', $item);
    node_field_update_node_field($item);
  }
}