-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flarum\Forum\Content\Discussion overriding extension settings #199
Comments
I agree it's a behavior that should be changed. Right now "global" content extenders added through
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We do this to keep the amount of open issues to a manageable minimum. |
As per flarum/framework#1891, we want to be able to override routes. This falls under the same category. Additionally, there should be support for removing a route. I wonder if priority-based overriding is overkill though. Anyways, the way I see this, there's several potential solutions:
I'm currently leaning towards (2). Any thoughts? |
Based on my past experience with Fastroute while working on https://kilowhat.net/flarum/extensions/custom-paths , I found its design isn't really fit for extensibility. I was completely unable to un-register routes due to the way everything is packed into strings of regexes. A third option would be to swap Fastroute with something else. I don't think it's too tied to anything. We could try to find a router library which allows adding, removing and replacing routes more easily. |
I like that FastRoute is quite lightweight and simple. Unfortunately it's not really maintained, but I remember that I looked at some point and didn't find significantly better alternatives. I think that adding a pre-processing step where we store routes as singletons and only register them when all extensions have booted (IE option 2) would probably be the simplest option. |
The issue of overriding sequence of content has not been solved with the linked pr. |
Bug Report
Current Behavior
Whenever I try to extend content behavior using
(new Extend\Frontend('forum'))->content(MyDispatcher::class)
, my callback is added beforeFlarum\Forum\Content\Discussion
. So I can't override settings like$canonicalUrl
, because they always get overwritten by the core component.Steps to Reproduce
(new Extend\Frontend('forum'))->content(MyDispatcher::class)
__invoke
function, try to set$flarumDocument->canonicalUrl
valueExpected Behavior
It would be very cool if we could prioritize the order of how extensions are executed. But for this specific issue,
MyComponent@__invoke
should be called afterFlarum\Forum\Content\Discussion@__invoke
in order to proper extend the desired functionality.Environment
The text was updated successfully, but these errors were encountered: