When I visit edit page (http://site_domain/en/admin/structure/menu/item/3008/edit) for a menu entry added by taxonomy_menu, I get the following errors:

Notice: Undefined index: #default_value in special_menu_items_form_menu_edit_item_alter() (line 181 of /path/to/site/sites/all/modules/special_menu_items/special_menu_items.module).

Notice: Undefined index: #description in special_menu_items_form_menu_edit_item_alter() (line 190 of /path/to/site/sites/all/modules/special_menu_items/special_menu_items.module).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tami.allen’s picture

I just had the same error when visiting my Admin>Menus page. I cleared my cache and it went away. I've been changing some settings on Views that were Main Menu items, I think that caused the error.

jsenich’s picture

The issue occurs when a menu item's link path is being controlled by another module such as views, panels (pages), etc. and there is not text field for link path.

jsenich’s picture

Status: Active » Needs review
FileSize
1.64 KB

Here's a patch.

gotobedsleepyhead’s picture

That fixed it - thanks!

dgastudio’s picture

Status: Needs review » Reviewed & tested by the community

patch fixes the problem.

dimitriseng’s picture

I can also confirm that the patch removes the warnings.

hwasem’s picture

I applied it as well and it seems to have resolved the error.

Thanks!

drzraf’s picture

confirmed, and attached a version generated with git diff -w for the sake of clarity.

gagarine’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
Haza’s picture

The patch from #8 don't respect the indentation inside the "if".

Patch from #3 seems better.

gagarine’s picture

Status: Fixed » Closed (fixed)

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

valery86’s picture

It worked for me too!!

Thanks !

BillyTom’s picture

Version: 7.x-1.x-dev » 7.x-2.0
Issue summary: View changes
Status: Closed (fixed) » Active

I am getting almost the same error in version 7.x-2.0:

Notice: Undefined index: #description in special_menu_items_form_menu_edit_item_alter() (line 138 of /var/data/vhosts/dev/httpdocs/drupal/sites/all/modules/special_menu_items/special_menu_items.module).

It happens when I edit menu items that have been created by panel pages. Clearing the cache does not remove the error. As far as I can tell the module works fine otherwise: other attributes like "class" and "title" are beeing displayed normally.

  • gagarine committed c777f0e on 8.x-1.x authored by jsenich
    #1407172 Undefined indexes when menu is controled by an other module
    
    
poker10’s picture

Status: Active » Fixed

Every time there is a $form['link_path'] and the default value set (https://git.drupalcode.org/project/special_menu_items/-/blob/7.x-2.x/spe...), there should be a #description attribute set as well, see:

https://git.drupalcode.org/project/drupal/-/blob/7.x/modules/menu/menu.a...

I suppose there was/is another module altering the form. Moving back to Fixed, as that is not a issue in this module. The module is working ok with taxonomy_menu and other programatically created menu items as far as i know. In case there is still an issue with this module, please create a new issue. Thanks!

Status: Fixed » Closed (fixed)

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