Problem/Motivation
Currently we only override the paragraph entity form classes. This leads to cases, where the actual paragraph does not have links like canonical, edit, etc., even though there exists forms for these links.
Furthermore this will bring many out of the box fixes and improvements, like views support for CRUD links and much more!
Steps to reproduce
Proposed resolution
Refactor paragraphs edit to use more streamlined paragraph entity routes / link templates. This will also make it able to display paragraph edit,delete and clone inside a view.
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
anybodyThanks @grevil yes this definitely makes sense and allows a lot better integration then, following established core-standards! Let's start a MR. If maintainers agree, it would be great to have a new default 4.x branch. Otherwise we should at least tag it with 3.1.0, but I think a fresh branch would make sense for BC. https://www.drupal.org/project/paragraphs_modal_edit may rely on it e.g.
Comment #4
grevil commentedAll done, please review! Note, that this still needs some further adjustments to resolve the todos. Nothing critical though, could be resolved in follow-up issues.
Comment #5
anybodyGREAT WORK @grevil many issues resolved and cleaned up things a lot. Perfect starting point for 4.0.0-alpha1!
Comment #6
anybodyThis should have tests to ensure it works as expected, especially regarding permissions to ensure not giving access to anyone for editing or exposing information, e.g. on the canonical, edit, delete or clone.
Comment #7
grevil commentedResolved your comments, please do a final check!
Comment #8
anybodyComment #9
grevil commentedStatic patch for the time being.
Comment #11
anybodyComment #12
anybody@lrwebks pipeline fails!
Comment #13
lrwebks commentedPHPUnit (previous minor) fails because of version incompatibility, so I am not sure what we can do about it?
Comment #14
anybodyReason was an unused use-statement and an upstream cspell issue with a trait method name.
Comment #15
anybodyAll green, ready for the (to be created) 4.x branch! 🎉
Comment #16
bbralaAwesome work! Left some small comments.
Also i wonder, would it be needed/useful to provide an upgrade path? Although it seems that is only for permissions?
Comment #17
anybodyGreat, thank you @bbrala! We'll come back to this in this or the next week!
Comment #18
anybodyBack to NW to resolve the comments finally! :)
Comment #19
anybodyComment #20
grevil commentedAlright, now we should be good to go!
Someone please do a final review! :)
Comment #21
anybody@bbrala would you check and sign this off maybe? Because I was participating in code here... I think that would make sense.
Comment #22
grevil commentedHold up, clone throws an error and delete emits a warning. Do we not have tests, that test the seperate forms? Back to NW.
Comment #23
grevil commentedComment #24
grevil commentedAlright, I added and refined existing tests and they currently fail as expected (because of the reasons above).
Gonna fix the code now.
Comment #25
grevil commentedOk, found an issue with the module. In Drupal, when "target_bundles" is NULL, ALL bundles are allowed, but "getPotentialCloneDestinations" treats it as no bundle is allowed instead.
I added a quick fix, but it is far from perfect yet. I first need to check, what "target_bundles_drag_drop" and why it was introduced this way back in #3270785: getPotentialCloneDestinations() doesn't always work. No time left today though.
Comment #26
grevil commentedAlright, that should be it! I refactored "getPotentialCloneDestinations". The old implementation didn't make much sense to me.
Again: For paragraph fields "target_bundles" is set to NULL explicitly to allow ALL paragraph types. Otherwise the value will be an array of allowed paragraph types (I added a check, to be 100% sure, that we are working with an array in that case. If it is a string or integer for whatever reason, we are using an empty array as fallback).
"negate" has only an effect, if "target_bundles" is NOT NULL. Otherwise we simply diff the target_bundles with all other available target_bundles.
I also adjusted the clone labels with internal feedback by @anybody. Please review!
Comment #27
anybodyRTBC+Ready for alpha1 from my side! But would like to have @bbrala's okay if possible.
Comment #28
anybodyOk I'll merge this now, think @bbrala is surely busy. Releasing an alpha1 and merging this into the fresh 4.x branch won't do any harm.
Comment #30
anybodyMerged! @grevil will you tag an alpha1?
@bbrala still feel free to check the code and create an issue if you find any further points to improve in 4.x! Thank you!!
Comment #32
bbralaWas sick for a bit, sorry about that :)
Comment #33
grevil commentedNo worries! Thanks for making 4.x the main branch :)