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

$term: A taxonomy term object.

Related topics

5 functions implement hook_taxonomy_term_insert()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

EntityCrudHookTestHooks::taxonomyTermInsert in core/modules/system/tests/modules/entity_crud_hook_test/src/Hook/EntityCrudHookTestHooks.php
Implements hook_ENTITY_TYPE_insert() for taxonomy_term entities.
entity_crud_hook_test_taxonomy_term_insert in modules/simpletest/tests/entity_crud_hook_test.module
Implements hook_taxonomy_term_insert().
path_taxonomy_term_insert in modules/path/path.module
Implements hook_taxonomy_term_insert().
taxonomy_test_taxonomy_term_insert in modules/simpletest/tests/taxonomy_test.module
Implements hook_taxonomy_term_insert().
trigger_taxonomy_term_insert in modules/trigger/trigger.module
Implements hook_taxonomy_term_insert().

File

modules/taxonomy/taxonomy.api.php, line 138

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.