Suggested commit message
Issue #2301313 by pwolanin, dawehner, Wim Leers, effulgentsia, kgoel, YesCT: MenuLinkNG part3 (no conversions): MenuLinkContent UI.
Problem/Motivation
UI was split out of part 1 and 2...
Proposed resolution
This part 3 of the patch adds edit/create forms for menu links and the corresponding routes.
Adds the paramconverter.menu_link service and corresponding class, though this is not used for route access checking until part4.
Remaining tasks
- (done) review UI. done by Bojhan, Gábor Hojtsy, and larowlan See #2227441-80: New plan, Phase 1:Review the architecture and overall implementation proposal for menu links as plugins and #2256521-144: [META] New plan, Phase 2: Implement menu links as plugins, including static admin links and views, and custom links with menu_link_content entity, all managed via menu_ui module
- review
- reorder the add/edit menu link field to have the required items at the top. or open a follow-up.
User interface changes
- Adds a UI for the new menu links following part #1 and #2.
- Uses the core html5 number element for weight.
- Adding and editing a menu link, and picking a different parent does not redirect to the new parent. on save, goes to the parent the menu was originally being added to or edited from. #2305353: Make redirect after saving a menu link into another parent menu, go to the parent menu admin form
- See comment #23 for screenshots.
API changes
Working on this issue
- To test the functionality of this patch all 5 parts must be applied
- https://github.com/pwolanin/drupal/tree/2256521-step5-2301319 may be a few days old or look for a patch on this issue that is the whole kahuna
- the sandbox is http://cgit.drupalcode.org/sandbox-dereine-2031809
- The branch 2256521-step3-2301313 is http://cgit.drupalcode.org/sandbox-dereine-2031809/log/?h=2256521-step3-...
- You must also enable the "custom menu links" in extend (rush en -y menu_link_content). This will not be necessary after part 5
Original report by @effulgentsia
Next chunk after #2301273: MenuLinkNG part2 (no UI or conversions): MenuLinkTree API and unit tests.
The "-do-not-test" patch does not include the stuff from #2301273: MenuLinkNG part2 (no UI or conversions): MenuLinkTree API and unit tests. The "-combined" patch does.
Comment | File | Size | Author |
---|---|---|---|
#44 | increment.txt | 8.94 KB | pwolanin |
#44 | 2301313-44.patch | 41.52 KB | pwolanin |
Comments
Comment #1
effulgentsia CreditAttribution: effulgentsia commentedComment #2
effulgentsia CreditAttribution: effulgentsia commentedComment #3
xjmComment #4
xjmComment #5
cosmicdreams CreditAttribution: cosmicdreams commentedIs this an accurate depiction of the UI improvements?
Comment #6
dawehnerthe doc is wrong, it is the parent form selector service.
(minor) absolute ...
We do have a follow up for this magic values already, yeah!
MenuLinkForm in head has a couple of validations related to the path but this does not matter here as we cannot change the path, yeah!!
Can we convert this straight into a @todo, so there is a lower change to be forgotten in the future
(minor) missing docs
Just a sitenode: it is okay to call t() here as it is part of a yml file as well and so scannable by POTX
i am not native but ... of menu links ... sounds better
newline needed before @see
maybe "Injects the menu link instance"?
This should tell what the method is supposed to do.
renamed to .links.task
needs some docs
do we have an issue to rename this method? this is no longer a route but a Url
I wonder whether we should rather go with $this->entity->delete instead?
we could replace it by a logger already
We could add a follow up to redirect to the menu form instead.
Let's use the MenuLinkContentInterface instead
some doc problem as before.
Let's document that loading by entity_id is faster
(minor) Break => Breaks
Nice: 80 chars comment!
it is a bit sad that we have similar code in both the default menu form and the content one, but this is okay, given that it is not complex code.
Is there a way to get this values from some entity form helpers? This should be a follow up
let's drop this newline
Let's use $this->t() instead
Let's avoid troubles and inject the service
ContentTranslationUITest is the best, seriously!
Needs to be replace by a @group Menu
I wonder whether each form should rather implement their own, given that the generated HTML looks totally different so could the styling!
(minor) $this->t()
We could or even should move it to core/config
schemas!!!
Comment #7
pwolanin CreditAttribution: pwolanin commentedrebased on 8.x, with conversion of MenuLinkElement to use methods (needs a little more cleanup)
Here's a new patch for this current step, and increment since the 1st patch
Comment #8
pwolanin CreditAttribution: pwolanin commentedlooking at #2304363: Make MenuLinkTreeElement's properties protected, add getters, add limited setters The method conversion isn't fully working, so rolling it back out of this patch for now.
IGNORE #7 please.
This increment is relative to the original patch posted by Alex.
Comment #10
Wim Leerspwolanin has pushed a commit to the sandbox that fixes all feedback in #6, but hadn't yet uploaded the patch here. So doing just that, so we can continue with the review process.
Comment #11
Wim LeersI also did a very quick, very high-level review (I posted the above patch but didn't work on this part at all).
Also, since this apparently (see #5) introduces an updated UI, I think we need usability review for this? Or was that evaluated already?
"Defines." But then this'll go beyond 80 chars.
What about:
"Defines a route controller for the menu link content entity creation form."
s/submission/creation/
s/the//
I think we still need to address these?
Extraneous newline.
Comment #12
pwolanin CreditAttribution: pwolanin commentedFixed most of these, looks like someone got a few before.
@dawehner
re: #6.14, it seems to be correct, it implements
ConfirmFormInterface::getCancelRoute()
re: #6.17 - no, this form does not depend on menu_ui module, so it should NOT redirect to a route provided by that module. I this we use a destination query string to override this redirect route.
re: #6.30 - not sure I understand what you mean
re: #6.32 - given that really nothing else in in the core config, I don't know that it makes sense - menu links are more part of system module so I think leave this where it is.
@Wim Leers
re: #11
Yes Bojhan, Gábor Hojtsy, and larowlan have done usability and UI review already. See:
https://www.drupal.org/node/2227441#comment-8803533 & https://www.drupal.org/node/2256521#comment-8958175
Added a follow-up issue for rendering options, a linked t existing bug reports about the form element for the boolean fields.
Comment #13
dawehnerOpened a followup: #2305023: Rename getCancelRoute to getCancelUrl
I got the impression that 'menu_link_edit' was somewhere else. Not sure what I thought exactly here.
Well, then please move the static menu override service into the system module.
Comment #14
pwolanin CreditAttribution: pwolanin commentedper Berdir, as of this morning, with boolean and list_boolean merged, the boolean should have a widget
So, we should probably test and re-roll to use that.
Possibly a last chance to change the field to "status" instead of "hidden"
Comment #15
pwolanin CreditAttribution: pwolanin commentedI'm not able to get the boolean form field to work so far, but trying to get feedback from Berdir about why.
Comment #16
pwolanin CreditAttribution: pwolanin commented@dawehner - other Core classes have config but it's not under core
for example:
core/lib/Drupal/Core/Theme/DefaultNegotiator.php
core/lib/Drupal/Core/Routing/UrlGenerator.php
so I think having Core services config under system module is the norm
Comment #17
dawehnerThe reason it is not there is because it used to be not possible to add a config to /core
Comment #18
pwolanin CreditAttribution: pwolanin commented@dawehner - I'm agnostic about where it lives, if it doesn't' disrupt the patch
Comment #19
pwolanin CreditAttribution: pwolanin commentedComment #20
YesCT CreditAttribution: YesCT commenteda couple issues in @todos are in the referenced by.
adding the other two, created from this issue.
Comment #21
YesCT CreditAttribution: YesCT commentedComment #22
YesCT CreditAttribution: YesCT commentedupdate first pass for UI review info
Comment #23
YesCT CreditAttribution: YesCT commentedupdating the issue summary also
----------
1. with only part #3 patch from #12, the links do not actually get created on save... but with the whole patch #5 (from github: https://github.com/pwolanin/drupal/tree/2256521-step5-2301319) it does work.
2. screenshot in #5 was of the views ui for adding a menu link, and that is the same in head as with patch #5.
3. the weight uses the core html5 number element
4. The order of the fields (right now) is different in the add and edit. Might try to change the patch so that the path required field is up at the top.
head
patch #3 (and #5)
5. the page menu settings fieldset thing is the same with and without the patch (well, almost the same. with the patch, uses the core html5 number element)
6. the add menu link link (not the + add link button/primarylink) does not have the ? destination redirect, so a save on the add page using that link, just reloads the edit form.
7. drupal installed in a subdir of the webroot causes reveals a bug with the destination so a save from the add or edit, or the delete is an error
8. mostly not related to changes here, but noticed while working on menu link things, is the suggestion to remove the weight from the menu link add/edit since the weight is out of context without the other menu links. (and the html5 number element does not have limits on it like the drop down used to). an old issue from 2009: #491022: Remove weight field from menu item entity forms
9. when adding a menu link to a menu, and then picking a different menu in the menu add form,
or when editing a menu link, and changing it's parent to another menu:
after saving get redirected to the original menu, not the new parent.
(in head, get redirected to the new parent menu)
#2305353: Make redirect after saving a menu link into another parent menu, go to the parent menu admin form
Comment #24
YesCT CreditAttribution: YesCT commentedin the sandbox, I moved the path up, with weight. Might look later at reordering the other fields to match head. but have to go for now.
Comment #25
xjmYeah, the config should be moved out of system now that this has been fixed.
Nice UI review YesCT!
Comment #26
webchickWow, fantastic work on that UI review! :D And thanks for fixing the path field weight; that would drive me absolutely nuts.
Comment #27
Wim LeersWhy did #12 add a @todo referring to #2226493: Apply formatters and widgets to Node base fields? Because that issue will also have to solve the problems seen here? That's the only way this could possibly be considered "related" — I am confused by #2226493-105: Apply formatters and widgets to Node base fields.
Comment #28
pwolanin CreditAttribution: pwolanin commented@Wim Leers - apparently those are the wrong issues about booleans - this went into core, so we should try to remove the hack and todo now: #2226063: Merge ListBooleanItem from options module into BooleanItem
Comment #29
pwolanin CreditAttribution: pwolanin commentedThe destination fix is in part 4, here's the other fixes for part 3, mostly moving the yml, and includes the 1st form fix from YesCT, fix to use the core boolean widget, and SafeMarkup fix for the admin form
Comment #30
cosmicdreams CreditAttribution: cosmicdreams commentedJust tried testing this with that handy Simplytest.me over there. Here's a screenshot pointing out a stray checkbox that appeared when I created a new menu with a new menu item:
And here's the markup for it.
Looks like the checkbox needs the visually-hidden class or something. This checkbox shouldn't be here.
Comment #31
pwolanin CreditAttribution: pwolanin commented@cosmicdreams - please don't test the UI of this patch - it's not functional for the plugins and still tries to use the old system. You need to test the next parts 4 or 5 to have a functional UI.
Comment #32
YesCT CreditAttribution: YesCT commentedI have a patch coming in a bit to reorder the fields on the menu link add/edit form.
Also, the show as expanded checkbox is missing after the Boolean element change,
and the operation link from the menu listing page, the operation to add a menu link.. goes to add a menu.
I'll look at fixing those also.
Comment #33
pwolanin CreditAttribution: pwolanin commented@YesCt - I think we should do that in part 4 so people can actually test it? Let's mar this one rtbc?
Comment #34
glide CreditAttribution: glide commentedAt Drupalcorn sprint
added instructions on how to try out the new work.
Comment #35
glide CreditAttribution: glide commentedAdded usage note about need to enable the custom menu link module
Comment #36
pwolanin CreditAttribution: pwolanin commentedHere's a now patch with some small cleanups including the form re-ordering from YesCT. Also moves a change to core/modules/menu_ui/menu_ui.admin.inc out that was premature and I added it back to part 4. This might have been the cause of the stray checkbox noted by @cosmicdreams.
Comment #37
dawehnerThere are for sure some nitpicks available here and there, but this is not a reason to block this
the progress. The moving of the form elements looks fine.
Comment #38
pwolanin CreditAttribution: pwolanin commentedOne more trivial fix from YesCT to align wording and remove a blank line.
Also, rebased on 8.x since part4 conflicts.
Comment #39
alexpottgetInternalPath() is deprecated - should we be using it here?
Missing params from doc block - plus $form is never used do we need to pass it?
Seems like we're missing a delete button.
Comment #41
dawehnerOpened a follow up for getPathFromRoute(): https://www.drupal.org/node/2307061 For now there is no better alternative to deal with destinations.
Comment #43
YesCT CreditAttribution: YesCT commentedgetPathFromRoute() might also be needed in part 4 for use while generating the destination for the add link link and delete links
Comment #44
pwolanin CreditAttribution: pwolanin commentedok, so the delete link was missing since the "delete-form" link was not in the entity links annotation and that's used by the access check. We must have missed a core change for that. The delete link now appears on the edit form.
Added a further @todo for getInternalPath() and links to the issue dawehner opened.
Fixed the doValidate() function doc.
Also, pulled in the MenuLinkPluginConverter since it should also be here as part of the purely new code.
A bunch of other doc fixes from YesCT
Comment #45
dawehnerThank you for the fixes!
Comment #46
alexpottOkay let's get to the meat/core (depending on your dietary requirements) of the patch - part 4!
Committed ef4e932 and pushed to 8.x. Thanks!
Comment #48
xjmTagging the child issues retroactively.