Problem/Motivation
views_menu_link_defaults() does not set a parent for links, so they can only be top-level in any menu.
Steps to reproduce
Apply the attached patch, which moves the Files link from a tab pointing to admin/content/files to a normal menu link pointing to admin/content. The link does not show up in the toolbar, and when you go to admin/structure/menu/manage/admin, you will see the link exists, but it's top-level instead of below Administration.
Proposed resolution
To be determined.
Remaining tasks
To be determined.
User interface changes
To be determined.
API changes
To be determined.
| Comment | File | Size | Author |
|---|---|---|---|
| #36 | interdiff.txt | 1.69 KB | dawehner |
| #36 | 2202493-views_match-36.patch | 6.18 KB | dawehner |
Comments
Comment #1
tim.plunkettComment #2
xanoNote that this patch is a demonstration of the problem and not a fix.
Comment #3
tim.plunkettIf we have a bug, we have a bug. we shouldn't be changing the UI to work around it.
I don't think this is a good approach.
Comment #4
xanoNote that this patch is a demonstration of the problem and not a fix.
Comment #5
xanoComment #7
xanoI decided not to convert tabs, but only focus on menu links in this issue, since, as opposed to Drupal 7, these are no longer handled through the same mechanism.
Comment #9
xanoComment #11
xanoComment #13
dawehnerDon't we still want to implement some magic to auto-set the parent based upon the path?
Comment #14
tim.plunkettMaybe something like this?
Comment #15
dawehnerThis will be problematic for a lot of reasons. We should use existing_links sadly, mh this is an N*M algorithm. The reason why we can't use it is that we are actually buillding menu links at the moment, which means that if at some points the menu links have to be actually rebuilt, good luck.
I will have a deeper look at this issue tomorrow.
Comment #17
xano@dawehner, @pwolanin, and I just had a chat about this and since the system now allows any link to be a child of any other link, we should let the user choose the parent instead of magically selecting it.
Comment #18
xanoRe-roll of #11.
Comment #20
xanoComment #21
dawehnerWe kind of need to be able to select no parent.
On top of that some tests would be kinda cool.
Comment #23
xanoThis is tricky, since the built-in code to build menu link selectors uses menu names and MLIDs as identifiers, because not all menu links have a machine name. The way Views exposes menu links requires them to refer to parents using machine names, though.
I guess this issue is postponed until menu links are converted to plugins.
Comment #24
longwaveMenu links are now plugins, this is still an issue and needs revisiting.
Comment #25
longwaveFirst attempt at a rework with menu link plugins. I could add a view display below an existing menu item and successfully edit it in either the menu UI or the Views UI in manual testing.
Comment #26
dawehnerI will try to come up with some proper tests unless someone beets me until tomorrow.
The default is an empty plugin ID "", not 0 anymore.
We could at least use $this->t()
Perfect!
Comment #27
longwaveFixed #26.1 and #26.2.
Comment #28
dawehnerHere is a test.
Comment #29
longwaveSurely
pgaeis a typo (twice) in that test?Comment #31
longwaveRebased and fixed test.
Comment #32
dawehnerUrg, I hate myself.
Comment #34
dawehnerThis should be it.
Comment #35
longwaveI think the Menu dropdown should be removed, the menu is selected via the Parent dropdown and the menu_name variable is overwritten at submit time anyway.
Comment #36
dawehnerYou are absolute right!
Comment #37
longwaveNot sure I am allowed to RTBC this as I worked on part of it, but I think #36 is good to go.
Comment #38
dawehnerI really think that everyone in the community should be allowed to RTBC any issue, as long you are convinced that is the right thing and fixes the described problem.
Comment #39
alexpottCommitted ce842f8 and pushed to 8.0.x. Thanks!