Commit 2274415c authored by davereid's avatar davereid Committed by Dave Reid

Issue #1489174 by Dave Reid: Fixed cache in menu_block_get_all_menus() not...

Issue #1489174 by Dave Reid: Fixed cache in menu_block_get_all_menus() not updated on book menu creation or deletion.
parent ebc7ef4b
......@@ -1030,3 +1030,30 @@ function menu_block_menu_order_set_menu($menu_name, $status) {
variable_set('menu_block_menu_order', $menus);
}
}
/**
* Implements hook_menu_link_insert().
*/
function menu_block_menu_link_insert($link) {
// If a book is being created, updated, or deleted, clear the
// menu_block_get_all_menus() cache since it means a change to a book "menu"
// that would need to be picked up by book_menu_block_get_menus().
if (strpos($link['menu_name'], 'book-toc-') === 0 && !$link['plid']) {
cache_clear_all('menu_block_menus:', 'cache_menu', TRUE);
drupal_static_reset('menu_block_get_all_menus');
}
}
/**
* Implements hook_menu_link_update().
*/
function menu_block_menu_link_update($link) {
menu_block_menu_link_insert($link);
}
/**
* Implements hook_menu_link_delete().
*/
function menu_block_menu_link_delete($link) {
menu_block_menu_link_insert($link);
}
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