As part of the broader effort to minimize the amount of boilerplate needed to create custom entities, I'd like to get rid of the various *.links.*.yml
files. As a first step, this issue tackles *.links.action.yml
. If there is an entity collection and either an add page or an add form, then we generate an action link from the former to the latter.
I chose this one to get the ball rolling, because in my opinion it is almost 100% makes sense for all entity types in terms of functionality. So hopefully we can discuss whether people like the implementation or have other ideas.
I have been using the code in production for a while now, although I just thought of the trick to use a custom action class to get the translation right when writing the patch. I also added a small test, although it's not amazing in terms of coverage I hope it suffices for now.
Once this lands or if at least this gets some approval/traction, I think we can tackle the other types of links step by step.
Comment | File | Size | Author |
---|---|---|---|
#6 | 2921844-6.patch | 9.53 KB | tstoeckler |
|
Comments
Comment #3
tstoecklerDamn it, I forget the @group every time. I added the other two, just because the other functional tests had them as well, not sure why, as usually that would be setup by
phpunit.xml
, no?Comment #4
tstoecklerComment #5
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedThe entity type could be derived from the plugin id by default. No need to iterate over all entity type definitions.
Comment #6
tstoecklerThanks for the review! Makes sense, fixed.
Comment #7
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedI like the patch, i have to write these yaml files all the time.
Comment #9
bojanz CreditAttribution: bojanz at Centarro commentedThanks!