#31874 by David Lesieur. Call taxonomy hook for insert and update after the term is fully saved.

5.x
Neil Drumm 2006-09-08 20:18:35 +00:00
parent f4e1c078bc
commit 0ae3912031
1 changed files with 6 additions and 2 deletions

View File

@ -427,7 +427,7 @@ function taxonomy_form_term_submit($form_id, $form_values) {
function taxonomy_save_term(&$edit) {
if ($edit['tid'] && $edit['name']) {
db_query("UPDATE {term_data} SET name = '%s', description = '%s', weight = %d WHERE tid = %d", $edit['name'], $edit['description'], $edit['weight'], $edit['tid']);
module_invoke_all('taxonomy', 'update', 'term', $edit);
$hook = 'update';
$status = SAVED_UPDATED;
}
else if ($edit['tid']) {
@ -436,7 +436,7 @@ function taxonomy_save_term(&$edit) {
else {
$edit['tid'] = db_next_id('{term_data}_tid');
db_query("INSERT INTO {term_data} (tid, name, description, vid, weight) VALUES (%d, '%s', '%s', %d, %d)", $edit['tid'], $edit['name'], $edit['description'], $edit['vid'], $edit['weight']);
module_invoke_all('taxonomy', 'insert', 'term', $edit);
$hook = 'insert';
$status = SAVED_NEW;
}
@ -478,6 +478,10 @@ function taxonomy_save_term(&$edit) {
}
}
if (isset($hook)) {
module_invoke_all('taxonomy', $hook, 'term', $edit);
}
cache_clear_all();
return $status;