Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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...
Comment | File | Size | Author |
---|---|---|---|
#5 | 1978528-deleted-menu-prevent-more-errors.patch | 2.13 KB | Dave Reid |
#5 | Selection_152.png | 74.29 KB | Dave Reid |
#4 | 1978528-deleted-menu-prevent-more-errors.patch | 1.43 KB | Dave Reid |
#2 | menu_block_undefined_index-1978528-2.patch | 968 bytes | bobodrone |
#1 | menu_block_undefined_index-1978528-1_0.patch | 1.12 KB | oriol masjuan |
Comments
Comment #1
oriol masjuan CreditAttribution: oriol masjuan commentedThis is the last patch but can be applied to:
Menu Block 7.x-2.3
Comment #2
bobodrone CreditAttribution: bobodrone commentedRemoved full path to module file in patch.
// BoboDrone
Comment #3
yerlix CreditAttribution: yerlix commentedI'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
Comment #4
Dave ReidI 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).
Comment #5
Dave ReidScreenshot 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.
Comment #6
Dave ReidTested and committed #5 to 7.x-2.x.