Problem/Motivation
Getting below error when adding/ editing menu link from group content menu after update from Drupal 10.1.7 to Drupal 10.2.0
Error: Call to a member function label() on null in Drupal\menu_link_content\Form\MenuLinkContentForm->form() (line 99 of /var/www/html/docroot/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php).
Steps to reproduce
1. Install group content menu.
2. Install group as well.
3. Then, Create menus type under the group content menu.
4. Now, Install the menu for the group type under the group content setting.
5. Try to add new link on group menu.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork drupal-3411384
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- drupal-3420768-3420768
compare
- 3411384-error-call-to
changes, plain diff MR !7228
Comments
Comment #2
venkatadapa commentedAttached a patch
Comment #3
shashank5563 commented@venkatadapa, Thank you, I have tested this on my project and found it is working as expected.
I am moving it for RTBC.
Comment #4
shashank5563 commentedComment #5
cilefen commentedThis patch has not been tested.
Is this something that should be fixed in the contributed module?
There must be missing tests of this is a core bug, and a regression.
Comment #6
banoodle commentedI upgraded to Drupal 10.2.2 and I also can no longer add links to Group menus.
Patch #2 fixes the issue for me, but I have created this task in the Group Content Menu issue queue to get visibility with the maintainers of that module: https://www.drupal.org/project/group_content_menu/issues/3417879
In the meantime, I'm going to have to use the patch on this issue - so thanks!
Comment #7
damienmckennaComment #8
heddnTraced this back to #3110371: When adding a new menu link, restrict the available parents to the current menu. It isn't in 10.1 but is in 10.2. GCM does not have a full config backed menu. It never will. Additionally, the menu parent logic is overwritten by that module after this here. The patch in #2 seems like a decent solution. An entity load can fail to load (that's what we see here). We should check and handle appropriately.
Still needs tests, but this can be easily reproduced. In a test controller add something like:
Comment #10
karimb commentedJust to mention that I applied the patch #2 and it works for me! Thanks.
Comment #14
alecsmrekar commentedComment #16
plachLooks good and works well here, I pushed a small commit to address @graber's review.
I only changed a word in a comment, so I think it's fine for me to RTBC this :)
Comment #17
alexpottMade some comments on the MR with a suggested change.
Comment #18
phthlaap commentedComment #19
smustgrave commentedAppears suggestions by @alexpott has been addressed.
Comment #21
alexpottCommitted and pushed 84432de226 to 11.x and cf919c8960 to 10.3.x and 22add58ea6 to 10.2.x. Thanks!