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.
This patch defines a new service and a new Access Checking handler.
Comment | File | Size | Author |
---|---|---|---|
group_role_access.patch | 2.64 KB | matslats | |
Comments
Comment #2
kristiaanvandeneyndeSo the goal is to have a _group_type requirement where you add the machine name as the value? Provided the route has a {group} parameter.
Do you have any example use cases for this? A little more explanation would go a long way :)
Comment #3
matslats CreditAttribution: matslats as a volunteer commentedYeah Sorry.
This patch enables a new requirement in the routing yml files
My use case builds extensively on one group type - every member of the site is in one and only one such group, but other group types are used also. So I want to make routes specific to group types.
Comment #4
kristiaanvandeneyndeRight, I see.
That actually makes a lot of sense and the code to achieve this is exactly how it should be done (i.e. a route requirement). I'm just on the fence whether we should add edge cases like these into the module or rely on people to put it in their "glue code" for the project that requires it.
I'm worried that if we add a lot of route checks like these and hardly ever use them, we'll decrease the performance or increase the complexity of the routing system for no good reason.
What do you think?
Comment #5
matslats CreditAttribution: matslats as a volunteer commentedI didn't suppose that route checks like this would affect performance.
The service is only loaded as needed.
The code is very discreet.
The meaning and usage is very straight forward.
Putting it in would I suppose save less-than-elite developers a lot of time working out how to do it.