hook_taxonomy_term_update

Versions
7
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 127

<?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();
      }
    }
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.