function hook_taxonomy_term_insert

Act on taxonomy terms when inserted.

Modules implementing this hook can act on the term object when saved to the database.

Parameters

Drupal\taxonomy\Term $term: A taxonomy term entity.

Related topics

2 functions implement hook_taxonomy_term_insert()

File

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

Code

function hook_taxonomy_term_insert(Drupal\taxonomy\Term $term) {
  db_insert('mytable')
    ->fields(array(
    'tid' => $term
      ->id(),
    'foo' => $term->foo,
  ))
    ->execute();
}