diff options
-rw-r--r-- | modules/taxonomy/taxonomy.api.php | 13 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/modules/taxonomy/taxonomy.api.php b/modules/taxonomy/taxonomy.api.php index 31aa2de52..c66ccdfb1 100644 --- a/modules/taxonomy/taxonomy.api.php +++ b/modules/taxonomy/taxonomy.api.php @@ -95,6 +95,19 @@ function hook_taxonomy_term_load($terms) { } /** + * Act on taxonomy terms before they are saved. + * + * Modules implementing this hook can act on the term object before it is + * inserted or updated. + * + * @param $term + * A term object. + */ +function hook_taxonomy_term_presave($term) { + $term->foo = 'bar'; +} + +/** * Act on taxonomy terms when inserted. * * Modules implementing this hook can act on the term object when saved to diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index b61a83dd1..5a184c337 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -469,6 +469,7 @@ function taxonomy_term_save($term) { } field_attach_presave('taxonomy_term', $term); + module_invoke_all('taxonomy_term_presave', $term); if (empty($term->tid)) { $status = drupal_write_record('taxonomy_term_data', $term); |