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.
Based on https://www.drupal.org/project/webform/issues/2861690#comment-12478835
We should introduce a new plugin type whose goal would be to suggest a source entity type from the current context. This should help with extending webform module by 3rd party developers and offload the pressure off WebformRequest::getCurrentSourceEntity()
so it doesn't grow infinitely as we introduce more and more logic into how to detect a source entity.
The patch is coming shortly.
Comment | File | Size | Author |
---|---|---|---|
#15 | 2944203-source-entity-plugin-type-15.patch | 32.56 KB | bucefal91 |
| |||
#15 | interdiff-14-15.txt | 1.4 KB | bucefal91 |
#13 | 2944203-source-entity-plugin-type-13.patch | 32.52 KB | bucefal91 |
| |||
#13 | interdiff-10-13.txt | 1.83 KB | bucefal91 |
#10 | interdiff-4-10.txt | 19.64 KB | bucefal91 |
Comments
Comment #2
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedThis is the patch. It contains the refactoring from https://www.drupal.org/project/webform/issues/2861690#comment-12452024 but not the bugfix. (I deliberately also omit a test case that exposes the bug so we do not break test pass if we commit this issue).
..working on the change record now.
Comment #4
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedhttps://www.drupal.org/node/2944230 - this is the change record.
The new patch should pass the tests. + I fixed some coding styling.
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThis is a huge API improvement.
Please are some general comments/questions...
If you are okay making the above and below changes and updating the change record, I will do a quick review and mark this RTBC.
BTW, I am reassigning the ticket to you so that you can visible credit is the Webform issue queue.
Can you please remove the WebformInteral namespace? This is not a core pattern and not really needed.
If we need to mark something as internal we can add @internal to all the related classes.
We should call this class RouteParametersWebformSourceEntity to match the naming conventions used by other Webform plugin name (except for WebformElements).
Remove /WebformInterna'/ and change to QueryStringWebformSourceEntity
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #7
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedI've gone through all your feedback. Will update now the change record.
Comment #9
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedChange record updated. :)
Thanks for willing to commit this :) I wasn't exactly sure whether you will like it because it does introduce some disturbance in the development and doesn't reward with any immediate end-user feature.
Let's see what the tests say. They will show if I overlooked anything while renaming/moving definitions.
---------
edit: actually they did :)
Comment #10
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedLet's see this one.
Comment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe code makes perfect sense because it splits the querystring and route detection into dedicated plugins definition with isolated business logic. This refactoring allows for an inevitable third source entity detection method to be easily added and tested.
Comment #13
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedA little more of coding standards.
Comment #14
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedAs far as I can judge, this is ready, Jacob.
Comment #15
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedJust a small improvement in the @see comments.
Comment #16
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI am marking this RTBC so that have can feel the 'reward of the merge', right after all the tests pass.
Comment #18
bucefal91 CreditAttribution: bucefal91 at Websolutions Agency commentedYupii! Committed. Should I mark the change record as published or that should happen when a new release is tagged?