Act on taxonomy terms when inserted.
Modules implementing this hook can act on the term object when saved to the database.
Drupal\taxonomy\Term $term: A taxonomy term entity.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_taxonomy_term_insert(Drupal\taxonomy\Term $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();
}
}
}
}