Skip navigation
Help

hook_taxonomy_term_update

7 taxonomy.api.php 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

5 functions implement hook_taxonomy_term_update()

File

drupal/modules/taxonomy/taxonomy.api.php, line 155
Hooks provided by the Taxonomy module.

Code

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