Commit 46298c90 authored by Dave Reid's avatar Dave Reid

Issue #1154122: Moved block module hook implementations to menu_block.module...

Issue #1154122: Moved block module hook implementations to menu_block.module to prevent problems with hook implementation caching.
parent ec24c519
......@@ -372,10 +372,6 @@ function _menu_block_block_save($delta, $edit) {
function menu_block_admin_settings_form($form_state) {
// Retrieve core's menus.
$menus = menu_get_menus();
// Include book support.
if (module_exists('book')) {
module_load_include('inc', 'menu_block', 'menu_block.book');
}
// Retrieve all the menu names provided by hook_menu_block_get_sort_menus().
$menus = array_merge($menus, module_invoke_all('menu_block_get_sort_menus'));
asort($menus);
......
<?php
/**
* @file
* Provides book integration.
*/
/**
* Implements hook_menu_block_get_menus().
*/
function book_menu_block_get_menus() {
$menus = array();
foreach (book_get_books() AS $book) {
$menus[$book['menu_name']] = $book['title'];
}
return $menus;
}
/**
* Implements hook_menu_block_get_sort_menus().
*/
function book_menu_block_get_sort_menus() {
return array(
'/^book\-toc\-.+/' => t('Book navigation'),
);
}
......@@ -132,10 +132,6 @@ function menu_block_get_all_menus() {
else {
// Retrieve core's menus.
$all_menus = menu_get_menus();
// Include book support.
if (module_exists('book')) {
module_load_include('inc', 'menu_block', 'menu_block.book');
}
// Retrieve all the menu names provided by hook_menu_block_get_menus().
$all_menus = array_merge($all_menus, module_invoke_all('menu_block_get_menus'));
// Add an option to use the menu for the active menu item.
......@@ -687,3 +683,23 @@ function menu_block_tree_output(&$tree, $config = array()) {
$hooks[] = 'menu_tree';
return $output ? theme($hooks, $output) : '';
}
/**
* Implements hook_menu_block_get_menus() on behalf of book.module.
*/
function book_menu_block_get_menus() {
$menus = array();
foreach (book_get_books() AS $book) {
$menus[$book['menu_name']] = $book['title'];
}
return $menus;
}
/**
* Implements hook_menu_block_get_sort_menus() on behalf of book.module.
*/
function book_menu_block_get_sort_menus() {
return array(
'/^book\-toc\-.+/' => t('Book navigation'),
);
}
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