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
ShortcutForm
uses the old pattern of checking whether it is an add or an update form to provide dedicated messages.
Also Shortcut module has some forms in \Drupal\shortcut\Form
and some in \Drupal\shortcut
which is kind of confusing and this mix needs a fix.
Proposed resolution
Split ShortcutForm
into ShortcutAddForm
and ShortcutEditForm
instead
Remaining tasks
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#49 | interdiff-2324873-44-46.txt | 2.07 KB | jibran |
#46 | split_shortcutform_into-2324873-46.patch | 4.81 KB | dev.patrick |
Comments
Comment #1
JeroenTWorking on this @ DUG Belgium
Comment #2
JeroenTCreated patch. I was unable to test it because of the following error when visiting url : admin/config/user-interface/shortcut
Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("Route "field_ui.overview_shortcut" does not exist.") in "core/modules/system/templates/links.html.twig" at line 50. in Twig_Template->displayWithErrorHandling() (line 291 of core/vendor/twig/twig/lib/Twig/Template.php).
Comment #4
jibranThis should need a reroll after #2428003: Move all shortcut forms to \Drupal\shortcut\Form.
Comment #5
zuhair_akComment #6
zuhair_akSplit the ShortcutForm.php to ShortcutAddForm.php and ShortcutEditForm.php. Made the changes in the annotations in Entity folder files to reflect the changes.
Comment #7
vg3095 CreditAttribution: vg3095 commentedUpdate to run the test bot
Comment #9
zuhair_akThis issue is dependant on the application of patch in - #2428003: Move all shortcut forms to \Drupal\shortcut\Form . Should we wait till that patch is applied?
Comment #10
jibranYou can combine the patches for now to get the proper test results.
Comment #11
tim.plunkettProbably out of scope, but there shouldn't two of these
Can we please remove this form operation?
This should let #2324877: Split ShortcutSetForm into ShortcutSetAddForm and ShortcutSetEditForm handle ShortcutSet and not move it
Honestly, this method is so simple I have no problem leaving it and won't fixing the issue.
There isn't sufficient motivation for this change in the issue summary.
Comment #12
therealssj CreditAttribution: therealssj commentedI don't quite see how this patch is dependent on #2428003: Move all shortcut forms to \Drupal\shortcut\Form
The tests must be failing because of some other reason.
I think we should set default form to edit the we wouldn't need to edit the routing.yml
@tim.plunkett
I don't quite understand what is mention in #11 4th comment.
Do you mean we should keep the same save() method in new ShortcutAddForm and ShortcutEditForm classes? ( This makes no sense though )
#11 1, Should we open a new issue for this?
New patch attached.
Comment #14
therealssj CreditAttribution: therealssj commentedIs this good enough summary update for motivation?
Comment #15
therealssj CreditAttribution: therealssj commentedWe should not remove the ShortcutForm class here.
Patch fix.
Comment #16
therealssj CreditAttribution: therealssj commentedGo test bot!
Comment #17
tim.plunkettWho decided that it was an "old pattern", and that a newer pattern would be better?
I think this class is fine as is.
Moving it to another namespace is fine.
Comment #18
therealssj CreditAttribution: therealssj commentedYes this does lead to redundant code.
The motivation for this might have been the fact that deleteform has a separate class but edit and add don't.
Though only changing the namespace seems fine and this should be closed as works as desgined and let the #2428003: Move all shortcut forms to \Drupal\shortcut\Form handle this.
Views?
Comment #20
naveenvalechaThis is now RTBC #2428003: Move all shortcut forms to \Drupal\shortcut\Form
Rerolled this patch
Comment #21
naveenvalechaComment #22
naveenvalechaUpdating issue summary.
Comment #23
jibranThanks for rerolling the patch @naveenvalecha.
s/Add/add.
s/Edit/edit.
What about this?
Comment #24
sidharthapThank you @Jibran, Updated patch file as per #23. Entity title link based on access added back.
Comment #25
jibranThanks for fixing the feedback. I think we can remove
from both classes.
Comment #26
sidharthapThank you @Jibran, Updated patch as per #25.
Comment #27
jibranThanks for the quick update. Can you please use
git diff -M20
to create a patch?Comment #28
sidharthapThanks @Jibran.
Here is the diff file between #20 and #26
Comment #29
jibranI was asking about updating the patch like this. Anyways I rerolled the patch. Thank you for your contribution. I think this patch is RTBC now.
Comment #30
alexpottCan someone explain how this falls into https://www.drupal.org/core/d8-allowed-changes? I'm not sure the current change is. But I might be wrong.
I think we can add the new forms but I'm not sure we can remove the old form - we need to deprecate it.
Comment #31
jibranPlease have a look at #2428003-27: Move all shortcut forms to \Drupal\shortcut\Form.
Comment #32
naveenvalechaRTBC +1
Re: #30
Per https://www.drupal.org/core/d8-bc-policy#controllers The Form classes are internals
Please also do give credit to the peoples who have worked in the duplicate issue https://www.drupal.org/node/2428003
Comment #33
catch@alexpott the form classes are entirely @internal so it should be fine.
We could add back the old class with a deprecation notice and not use it, but for me the likelihood of someone extending shortcut forms should be close to zero?
Comment #34
alexpottI think we need a change record here. The CR needs to explicit mention how a contrib module could support both 8.2.x and 8.3.x if they are extending these classes. As far as I can see the best way would be to just not extend the classes and do the functionality themselves.
Comment #35
webchickRemoving 8.3.0 release notes for now, since this is not in 8.3.0 yet.
Comment #38
jibranComment #39
dev.patrick CreditAttribution: dev.patrick as a volunteer and at TATA Consultancy Services for Pfizer, Inc. commentedAdding rerolled patch. Only conflict while rebase was deleted file ShortcutForm.php.
Comment #40
dev.patrick CreditAttribution: dev.patrick as a volunteer and at TATA Consultancy Services for Pfizer, Inc. commentedComment #42
dev.patrick CreditAttribution: dev.patrick as a volunteer and at TATA Consultancy Services for Pfizer, Inc. commentedComment #43
jibranThanks, for the reroll.
We are not using short version of array now.
Comment #44
dev.patrick CreditAttribution: dev.patrick as a volunteer and at TATA Consultancy Services for Pfizer, Inc. commentedThanks Jibran, corrected your mentions.
Comment #45
jibranThanks for the fixes. Please also upload the interdiff.
use of
l
is deprecated let's use$this->getLinkGenerator()->generate()
instead.Let's remove
$message
variable.Comment #46
dev.patrick CreditAttribution: dev.patrick as a volunteer and at TATA Consultancy Services for Pfizer, Inc. commented@jibran, Adding suggested correction 1 & 2. However for interdiff if I get it correct I need to provide interdiff b/w #39 & #46.
But #39 seems to be corrupt, could you please guide? Really appreciate your guidance on it.
Comment #47
jibranThanks for updating the patch. @dev.patrick you can create an interdiff from #42 in #44 also you can create interdiff for #46 form #44.
I have created the change notice https://www.drupal.org/node/2920117.
Comment #48
dev.patrick CreditAttribution: dev.patrick as a volunteer and at TATA Consultancy Services for Pfizer, Inc. commented@jibran, thanks for reviewing, uploaded both interdiff as asked.
Comment #49
jibran@dev.patrick those are not correct these are correct.
Comment #50
dev.patrick CreditAttribution: dev.patrick at TATA Consultancy Services for Pfizer, Inc. commentedHmm, am doing lots of mistakes :( Appreciate your time for correcting and guiding.
Comment #51
xjmLet's deprecate the old class rather than removing it, per https://www.drupal.org/core/deprecation#internal. (This is what #30, #33, #34 above are discussing.) Thanks!
Comment #52
xjmFor #51.