hook_taxonomy_term_update

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 hook_taxonomy_term_update($term)

Act on taxonomy terms when updated.

Modules implementing this hook can act on the term object when updated.

Parameters

$term A taxonomy term object.

Related topics

Code

modules/taxonomy/taxonomy.api.php, line 155

<?php
function hook_taxonomy_term_update($term) {
  hook_taxonomy_term_delete($term);
  if (!empty($term->synonyms)) {
    foreach (explode("\n", str_replace("\r", '', $term->synonyms)) as $synonym) {
      if ($synonym) {
        db_insert('taxonomy_term_synonym')
        ->fields(array(
          'tid' => $term->tid, 
          'name' => rtrim($synonym),
        ))
        ->execute();
      }
    }
  }
}
?>