-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[5.1] Improve onRouterInitialise event #43015
Conversation
@Fedik do not rename the event now! I've already updated and released my extensions to users based on the onAfterInitialiseRouter event name. |
@joeforjoomla To late! I have renamed it already! Please learn how to be more polite, thanks in advance. upd. I will restore old name |
@Fedik thank you 🙏. Current code is both using the AfterInitialiseRouterEvent event class and onAfterInitialiseRouter event name. |
@Fedik I don't see how this solves the basic issue we have. This helps a bit with people who create the siterouter in the constructor, but if they also create a link or parse a link at that time, we are at the same place we've been before. I also think this is rather a lot of code to achieve this... When I introduced the new event, I thought it would be better to not load the siterouter every time, especially when we don't even need it, but looking at the alternative, I'd rather go back to the old solution and live with that... @joeforjoomla I understand that you already released code which uses this, but we do have an issue here and we will have to fix it, which also could mean reverting the whole event for this again. |
Hm , they should use Maybe can make a rule in the SiteRouter constructor? kind of
Or yea, just revert that. |
I have tested this item ✅ successfully on 6187bd5 BUT: There is a downside compared to the approach taken in #43009. Core question is: When do we add additional router rules? We have 3 different approaches for that question.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43015. |
hmhm, yeah, it is still not very reliable. I close this pr, maybe in future we will come up with some better solution. |
Pull Request for Issue #42991, alternative to #43009.
Summary of Changes
Instead of calling the event directly after the class instantiation, we better call it explicitly, before it is used.
I renamed the event.Also I have add a message to warn the developers not to use Route before initialisation. Hovewer, in future, we need more reliable way to detect when aplication is initialised than use of $app->getLanguage() 😄
@Hackwar please check
Testing Instructions
Please follow #42991
And re test:
Actual result BEFORE applying this Pull Request
#42991 produce an error
Expected result AFTER applying this Pull Request
All works,
Older PRs works as before.
Link to documentations
Please select: