That is not common issue and most of menus working fine, but for some of them I have got this:

Notice: Undefined index: menu-produktmeny in menu_tree_build() (line 304 of menu_block.module
Notice: Undefined index: title in menu_block_get_title() (line 413 of menu_block.module

Patch attached in case if somebody has similar issue...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

oriol masjuan’s picture

This is the last patch but can be applied to:
Menu Block 7.x-2.3

bobodrone’s picture

Issue summary: View changes
FileSize
968 bytes

Removed full path to module file in patch.

// BoboDrone

yerlix’s picture

I've had the same issue with version 2.4, so I first tried this patch, but with no success.

Then I've used the code from this patch, to create a patch for version 2.4.
This patch can be found here: https://www.drupal.org/node/2349407#comment-9208743

Dave Reid’s picture

Status: Active » Needs review
Related issues: +#2349407: Undefined index in menu_tree_build()
FileSize
1.43 KB

I actually think having the PHP notice is a *good* thing since it needs to be addressed. This is the same as core's menu_block_view() which throws the same PHP notice. But we can prevent further errors too with this patch.

Also note that #2419523: Add menu_block_delete() API and respond to menu deletion will prevent this from happening with core block module if you delete a menu being used with a menu block, but it won't do anything if you're using a menu block as a CTools content type plugin (Panels or Panelizer).

Dave Reid’s picture

Screenshot of a Panel admin page that has both a core block menu, and a menu block menu that both are configured to display a menu that has been deleted. I think this is an appropriate solution.

Dave Reid’s picture

Status: Needs review » Fixed

Tested and committed #5 to 7.x-2.x.

  • Dave Reid committed b4280bd on 7.x-2.x
    Issue #1978528 by Dave Reid, omasjuan, bobodrone, babruix, yerlix: Fixed...

  • Dave Reid committed b4280bd on 7.x-3.x
    Issue #1978528 by Dave Reid, omasjuan, bobodrone, babruix, yerlix: Fixed...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.