Problem/Motivation
Blocks
#2417423: Re-process the user-entered-paths for custom menu links when there is a menu rebuild
and
#2417367: Use the new entity: URI scheme
will help with
#2416987: Fix UI regression in the menu link form
#2406749: Use a link field for custom menu link added support for using LinkItem on MenuLinkContent, but there was no support
added to use an actual general link widget.
Proposed resolution
Use the link widget.
Remaining tasks
- (done) review
- (done) file (or link/document) follow-ups
- (done) change record updated
User interface changes

Changes:
without patch label is:
"Link path"
helptext is:
"The path for this menu link. This can be an internal Drupal path such as node/add or an external URL such as http://drupal.org. Enter to link to the front page."
with patch:
has a fieldset (boarder style)
label is:
Link
URL
helptext is:
"This can be an internal Drupal path such as node/add or an external URL such as http://drupal.org. Enter to link to the front page.
The location this menu link points to."
#2416987: Fix UI regression in the menu link form Will rework the UI
API changes
The data in the table is stored like path in HEAD and like
user-path:pathOR entity:node/1
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | Screen Shot 2015-01-31 at 01.29.58.png | 138.75 KB | dawehner |
| #18 | 2416955-18.patch | 11.88 KB | amateescu |
| #18 | interdiff.txt | 670 bytes | amateescu |
| #21 | widgetorderfix.png | 557.41 KB | yesct |
Comments
Comment #1
andypostComment #2
dawehnerLet's see how feasible it is now.
Comment #3
webchickCan't help with the issue summary update, but since this is a corollary to #2406749: Use a link field for custom menu link it should inherit the tag.
Comment #4
dawehnerLet's see... note: this patch has #2417333: Add support for user-path: scheme to Url class applied.
I disagree that tags necessarily are inherited, but here we store different after it.
Comment #5
dawehnerComment #6
dawehner.
Comment #8
yesct commentedwe are going to try and get this done.
Comment #9
yesct commentedComment #10
dawehnerLet's fix it.
Comment #11
jibranHere is do not test patch without #2417333: Add support for user-path: scheme to Url class for review.
Comment #12
webchick#2417333: Add support for user-path: scheme to Url class just got committed so this probably needs some adjustment.
Comment #13
dawehnerReroll
Comment #14
yesct commentedI will manually test. and add screenshots.
Comment #15
yesct commentedthere is slight changes in the help text which I think is ok.
before:
The path for this menu link. This can be an internal Drupal path such as node/add or an external URL such as http://drupal.org. Enter to link to the front page.
after:
This can be an internal Drupal path such as node/add or an external URL such as http://drupal.org. Enter to link to the front page.
The location this menu link points to.
but strange reorder in show as expanded and enabled checkboxes.
there is a field set around the one with the patch. which I think is fine.
Comment #16
dawehnerQuickly fixed the order.
Comment #17
effulgentsia commentedWhy are we removing this? But, no need to hold this up on that. Can always add it back later if needed, the rest of the patch looks good, and getting this in will help with #2417423: Re-process the user-entered-paths for custom menu links when there is a menu rebuild and #2416987: Fix UI regression in the menu link form, so RTBC.
Comment #18
amateescu commentedI tested the patch manually and everything seems to work properly. Also fixing #17.
Comment #19
kgoel commentedWell, adding this description cripples the UI a bit more. If you are fine with it, sure, that is fine.
Comment #20
dawehnerThis at least blocks #2417367: Use the new entity: URI scheme
Comment #21
yesct commentedah, that description was in head.
nice catch. we should keep it and not make that change accidentally.
updating issue summary with UI changes and new screenshot.
do we need to add any change to change record: Configurable link field, short cut, menu links store user entered paths as URI (not routes or paths): https://www.drupal.org/node/2417421 or a different change record?
Comment #22
yesct commentedComment #23
anavarreOn the UI, things look a bit backwards/redundant for me. Looking at the very handy widgetorderfix.png file in #21, I see:
The name of the page is already Add menu link and the first field is Menu link title. We know we're manipulating a link, don't we? Why wouldn't we simply drop the Link fieldset and replace it by URL fieldset only? In Drupal we know a link is composed of a link title and an associated URL. We shouldn't need this extra clarification.
So that was the redundant part. Now for the backwards part:
When you read the help text, it seems to me The location this menu links points to. should come first, just below the field. Why? Simply because it generally describes the action we want the user to perform. The This can be an internal Drupal path such as node/add or an external URL such as http://drupal.org. Enter to link to the front page." text is the detailed version that was originally (before the patch) after The path for this menu link.. And it made more sense IMO. The location this menu links points to. could simply come before the same paragraph, or if we really want to, in its own paragraph before the detailed instructions.
Comment #24
yched commentedThis now hardcodes logic on the inner form structure of the widget, which is not ideal.
Not sure how doable that is, but it would be best to use the $entity that already has been built from the form values in both buildEntity() (which calls extractFormValues()) and validate() (which calls doValidate()).
I don't really grasp what extractFormValues() is about, it seems to be much more specific (it's from MenuLinkFormInterface, and "Extracts a plugin definition from form values" - not clear which kind plugin we're talking about) than what it's very generic name seems to imply in the context of an EntityForm. Not introduced by this patch but not helping figuring out the above :-)
Comment #25
effulgentsia commentedI agree with both #23 and #24, but suggest that we open follow ups for them, since that can be worked on in parallel or after the issues that are blocked by this.
Comment #26
yched commentedSure, followup is fine by me
Comment #27
yched commentedOpened #2417783: Remove widget specific logic in MenuLinkContentForm
Comment #28
yesct commented@anavarre Good points. That will be done in #2416987: Fix UI regression in the menu link form.
Comment #29
yesct commentedComment #30
webchickHm. So I will say of the sprint patches I've committed so far, this one makes me the most nervous, since it introduces very obvious regressions in the UX that we can't really ship with, as well as questionable logic per #24. However, my understanding is this is needed in order to make progress on the next round of blockers, and it does fulfill the "fix the data model" portion of this effort. So as long as those follow-ups get done, I think we're ok here.
Committed and pushed to 8.0.x. Thanks!
Comment #32
yesct commentedupdated the change record
the other UI follow-up is critical.