User tests: Successful: Unsuccessful:
Pull Request for Issue #42991, alternative to #43009.
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
Please follow #42991
And re test:
#42991 produce an error
All works,
Older PRs works as before.
Please select:
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries Front End Plugins |
Labels |
Added:
bug
PR-5.1-dev
|
@joeforjoomla To late! I have renamed it already!
Please learn how to be more polite, thanks in advance.
upd. I will restore old name
Category | Libraries Front End Plugins | ⇒ | Libraries |
@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.
but if they also create a link or parse a link at that time, we are at the same place we've been before.
Hm , they should use Route::link()
:)
Maybe can make a rule in the SiteRouter constructor? kind of
$this->attachParseRule([$this, 'initialiseCustomRules'], self::PROCESS_BEFORE);
Or yea, just revert that.
I have tested this item ✅ successfully on 6187bd5
Test result: Works as described.
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.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-03-13 09:41:42 |
Closed_By | ⇒ | Fedik |
hmhm, yeah, it is still not very reliable.
It will be more safe to revert it.
I close this pr, maybe in future we will come up with some better solution.
@Fedik do not rename the event now! I've already updated and released my extensions to users based on the onAfterInitialiseRouter event name.
We are at Beta 1!