| 7 taxonomy.api.php | hook_taxonomy_term_insert($term) |
| 8 taxonomy.api.php | hook_taxonomy_term_insert(TaxonomyTerm $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
4 functions implement hook_taxonomy_term_insert()
File
- modules/
taxonomy/ taxonomy.api.php, line 132 - Hooks provided by the Taxonomy module.
Code
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
Comments
taxonomy_term_synonym
Why functions have table 'taxonomy_term_synonym', but database of Drupal 7 don't have this table?
It will be work in future?