Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
For entity routes using an entity route provider is superior to declaring the routes statically as they can be more easily altered, for example.
Proposed resolution
Replace contact_storage.routing.yml
with a MessageRouteProvider
.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#18 | use_an_entity_route-2476591-18.patch | 4.04 KB | Bambell |
|
Comments
Comment #1
tstoecklerWhile moving the definitions over I also fixed them to use
_entity_access
instead of_permission
directly. Everything else should be unchanged.Comment #2
tstoecklerSometimes it really helps to actually try things...
tstoeckler--
I sincerely hope #1 is red, otherwise we need some tests for this...
Comment #4
andypostComment #5
BerdirCan we switch to the default html route provider now and check how much we can remove?
#1 was red, I think we have existing tests that cover this?
Comment #6
larowlanBumping
Comment #7
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedThe patch wouldn't apply, so I re-rolled it. All static routes are removed (
contact_storage.routing.yml
) and I added the missing code tocontact_storage.module
andMessageRouteProvider.php
.Comment #8
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedComment #9
Berdirno longer needed.
Extend from DefaultHtmlRouteProvider, that should cover edit, delete and canonical.
Comment #10
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedYup. Done.
Comment #11
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedComment #12
BerdirJust call $route_collection = parent::getRoutes() first, then you can drop those parts completely.
Comment #13
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedRight. I should have better looked at
DefaultHtmlRouteProvider
.Comment #14
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedComment #15
andypostduplicated twice in patch?!
Comment #16
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedNeed to define route providers for both contact_form and contact_storage entities, but it does appear to be the same in both cases, so I made some changes..
Comment #17
BerdirHm. Given that we use the same, it is a bit weird that we call it MessageRouteProvider, maybe that confused @andypost a bit?
What about renaming to ContactRouteProvider?
Then we are ready I think.
Comment #18
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedSure. I renamed the class to
ContactRouteProvider
.Comment #19
Bambell CreditAttribution: Bambell at MD Systems GmbH commentedComment #20
BerdirThank you.
Comment #22
andypostThanx, commited and pushed
Comment #23
tstoecklerYay! Thanks @all for pushing this forward and getting it done!
Bambell++