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.
Problem/Motivation
1. Create a page, select "Home" parent
2. Edit, select "< Main navigation>"
=> The menu link is still below home in the menu block (= doesn't show) and in the link list when editing the menu. But in the node form and the menu link edit form, the parent shows up correctly.
The reason is that while saving, the empty string in parent is considered empty and dropped, then getParentId() returns NULL. NULL for the menu tree storage however means "keep using the existing parent" (I don't even want to know why... about as strange as taxonomy term parent behavior).
Proposed resolution
Cast getParentId() to a string.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#6 | menulinkcontent_menu-2781673-6.patch | 1.65 KB | Bambell |
Comments
Comment #2
Berdir#2769299: node:menu-link:parents:join-path doesn't work as expected has some tests, we just need to remove the token/pathauto stuff from it and just check the menu link API directly.
The test is even fully Wim Leers-compatible already.
Comment #3
BerdirNote: Workaround is to move the menu link to the right position in the list of links and save there. But not everyone has access to that, e.g. users might only be able to create/manage menu links for nodes they can create/update.
Comment #4
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedHere's a test only patch against 8.2.x.
Comment #5
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedOr rather (small mistake)...
Comment #6
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedAnd the combined patch.
Comment #9
larowlanLooks good to me
Comment #10
dawehnerWow, nice catch!
Comment #12
BerdirNo idea what happened there.
Comment #14
dawehnerComment #15
BerdirStill green. weird, not even seeing failing results in the history?
Comment #18
catchCommitted/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!