Here is an error I do not understand:
Undefined index: menu-user-example in menu_tree_build() (line 256 of example.com/public_html/sites/all/modules/menu_block/menu_block.module).
The code at line 249 says:
if (empty($config['menu_name'])) {
return array();
}
The code at 256 says:
menu_block_set_title(t($menu_names[$config['menu_name']]));
We currently have only one menu block and it uses "the menu selected by the page". From what I can see of the error, the menu block might be on a page that is not selecting a menu from the default list. If that is normal, I would expect the code would have something like:
if (empty($menu_names[$config['menu_name']])) {
return array();
}
http://drupal.org/node/1232308 sounds similar but our problem is not a result of an upgrade. The system has too many pages and too much activity to test them one at a time.
The error is made more complex by menu-user-example
not appearing anywhere in the database.
I tried to reproduce the error on our test system but could not find the page creating the problem. I might have to add diagnostic code around line 256. Can I trace the error back through the database without adding code?
If I do add code, what variables would tell me the cause of the problem?
Comment | File | Size | Author |
---|---|---|---|
#7 | 1489174-book-changes-clear-get-all-menus.patch | 1.04 KB | Dave Reid |
Comments
Comment #1
803redman CreditAttribution: 803redman commentedComment #2
gmclelland CreditAttribution: gmclelland commentedI believe I'm experiencing the same thing.
Here is the error I get:
Notice: Undefined index: book-toc-14 in menu_tree_build() (line 317 of /home/quickstart/websites/updater.dev/profiles/cmf/modules/contrib/menu_block/menu_block.module).
Steps to reproduce
1. Enable the book module
2. Create a Menu Block with the following settings
--Block Title= Blank
--Menu =
<the menu selected by the page>
--Starting level = 2nd level (secondary)
--Make the starting level follow the active menu item = checked
--Starting level will be= Active menu item
--Expand all children of this tree = checked
3. Place the block in the sidebar
4. Goto admin/config/user-interface/menu-block
--Set the "Book navigation" menu available to "checked"
5. Create a new book page
--Select the "Book outline" tab and choose "New Book"
6. Save the node and BAM there's my error.
Note: you can get rid of this error message by clearing the menu cache, but then it comes back every time a new book is created.
Hope that helps. Let me know if you need more info.
Comment #3
JohnAlbinThe problem is that
menu_block_get_all_menus()
is over-zealously cacheing the list of menu names. Clearing the cache fixes it.It's possible implementing hook_menu_insert and hook_menu_delete to clear menu_block's cache will fix the issue.
Comment #4
JohnAlbinComment #5
JohnAlbinActually, the book module doesn't cause those hooks to fire when books are created. blargh.
Comment #6
Dave ReidComment #7
Dave ReidI think this should resolve it.
Comment #9
Dave ReidCommitted #7 to 7.x-3.x and 7.x-2.x.