Commit 0ae39120 authored by drumm's avatar drumm
Browse files

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

parent f4e1c078
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment