hook_taxonomy_term_insert
- Versions
- 7
hook_taxonomy_term_insert($term)
Act on taxonomy terms when inserted.
Modules implementing this hook can act on the term object when saved to the database.
Parameters
$term A taxonomy term object.
Related topics
Code
modules/taxonomy/taxonomy.api.php, line 104
<?php
function hook_taxonomy_term_insert($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 