- Issue created by @mykola dolynskyi
- Merge request !107new alter hook for auto_redirect https://www.drupal.org/project/redirect/issues/3464899 β (Open) created by mykola dolynskyi
- Status changed to Fixed
5 months ago 6:29pm 8 August 2024 - Status changed to Needs review
5 months ago 6:37pm 8 August 2024 - π¨πSwitzerland berdir Switzerland
Unsure about adding more rather arcane extension points. What if we'd convert the logic into a service, then you can decorate the service and have it not call the parent?
Alterantively, you could use a module implements alter hook and manually either call or don't cal redirect hooks from your own hook.
- πΊπ¦Ukraine mykola dolynskyi Poltava
@berdir, service is a good way, but you can`t "just provide hook with service", you will need to review all the code and move all logic into it exposing API, only after that refactor it to make small overridable function as a hook alternative. This is not the scope of task I described and much more work.
Service decoration is still not a callback accumulation if 2 separate modules do provide content type not required for for aliasing, then I need module #3 just to override service and properly collect entity types from 2 modules.
P.S. Imagine me doing that service as described above and then you come saying "Not sure we need such a big change" (which typical in drupal.org) and then it meaned I wasted 5h and still must create small-code patch, because unlike big refactor patch it can be long term living, and I have to support clients.
So hook is the best on my opinion at this moment.
If there is a wish to shift module logic to service - that is a different task and new version of the module.