summaryrefslogtreecommitdiff
path: root/modules/menu
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-03-07 07:55:14 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-03-07 07:55:14 +0000
commit559ee07db5a3a236da81696cba14c14910f44d7f (patch)
tree0c203625ff42b768fb5aed1bab4588835c752efb /modules/menu
parentc5c033dc059b1c293779ff224023d51edb26dead (diff)
downloadbrdo-559ee07db5a3a236da81696cba14c14910f44d7f.tar.gz
brdo-559ee07db5a3a236da81696cba14c14910f44d7f.tar.bz2
#473082 follow-up by sun: Remove odd breadcrumb bug workaround in menu_save().
Diffstat (limited to 'modules/menu')
-rw-r--r--modules/menu/menu.module23
1 files changed, 9 insertions, 14 deletions
diff --git a/modules/menu/menu.module b/modules/menu/menu.module
index 93a124245..12381543c 100644
--- a/modules/menu/menu.module
+++ b/modules/menu/menu.module
@@ -249,8 +249,6 @@ function menu_load_all() {
* - menu_name: The unique name of the custom menu.
* - title: The human readable menu title.
* - description: The custom menu description.
- * - old_name: For existing menus, the current 'menu_name', otherwise empty.
- * Decides whether hook_menu_insert() or hook_menu_update() will be invoked.
*
* Modules should always pass a fully populated $menu when saving a custom
* menu, so other modules are able to output proper status or watchdog messages.
@@ -258,7 +256,7 @@ function menu_load_all() {
* @see menu_load()
*/
function menu_save($menu) {
- db_merge('menu_custom')
+ $status = db_merge('menu_custom')
->key(array('menu_name' => $menu['menu_name']))
->fields(array(
'title' => $menu['title'],
@@ -267,17 +265,14 @@ function menu_save($menu) {
->execute();
menu_cache_clear_all();
- // Since custom menus are keyed by name and their machine-name cannot be
- // changed, there is no real differentiation between inserting and updating a
- // menu. To overcome this, we define the existing menu_name as 'old_name' in
- // menu_edit_menu().
- // @todo Replace this condition when db_merge() returns the proper query
- // result (insert/update).
- if (!empty($menu['old_name'])) {
- module_invoke_all('menu_update', $menu);
- }
- else {
- module_invoke_all('menu_insert', $menu);
+ switch ($status) {
+ case SAVED_NEW:
+ module_invoke_all('menu_insert', $menu);
+ break;
+
+ case SAVED_UPDATED:
+ module_invoke_all('menu_update', $menu);
+ break;
}
}