-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[4.0] [RFC] Should routing changes from 3.8.4 remain in 4.0 or should be reverted too? #19537
Comments
Could you explain the benefit of the change you propose |
I feel like I should inform you that this change made in the version 3.8.4 broke hundreds, if not thousands, of websites that were using third party extensions. |
@alessio-gaggii thanks for Comment, its a knowing Issue, for Example #19512. |
As it will be reverted for 3.8.5 (coming soon), anything similar already merged into 4.0 should imho be reverted. |
@infograf768 OK, it will easier to merge 4.0 with 3.8.5. If I find enough energy, I will try to create a new PR at 4.0 and I will describe it better. |
Few points:
|
If you go directly to page
Hmm, Assume that I installed fresh joomla 3.8.3 (single language) and created 3 top menu items:
Then I created a few categories and articles.
Now I create a module to display "top 10 news" and another for archive articles.
If we change home page to login page then link to article from home page will be
Thus, the generated link depends on the page on which it was generated and on type of home page. To workaround it, I suppose you will advice to create menu item for every category or for one for "the categories view". OK, it helps. But as we can see, many people did not do it. If you create a new category without menu item (you forgot) and we do not have a menu item for "the categories view" then link to new article from that category can be:
My PR stopped generates link like in 1-4 and only generates from point 5. This way an administrator will see an URL like "/component/..." and can understand that should create a new menu item for that category. Currently (in 3.8.3) It is difficult to find such a category because link to article may have different links. The other thing is The correct code should be Every menu item requires |
How would a user end up on such a page if not by a router that's not inheriting the current Itemid?
Please don't change 10 years of behavior just to solve a problem that's actually a configuration issue. It really shouldn't matter if I type
I need to specify a different view & sometimes a task as well, yet I expect the Itemid to be carried over because: |
To my knowledge, that URL wouldn't have generated by JRoute like this. It would look rather like this: /component/content/article/1-article?Itemid=101. That happens if the router can't find a matching Itemid for a given component (in this case for com_content). Then it falls back to that component URL, but it will still append an Itemid. Either the one from the homepage, the passed one or the active one. If you end up with an URL without Itemid generated by JRoute, then that is a bug which needs fixing. |
there is a an exception to this rule ? a login URL ? and if last selectable menu item for a login is not accessible by current user (last selectable is the home page menu item), then it is should not be added, right ? because you will get a redirect loop |
There should be no exception, there should always be an Itemid. Basically Joomla breaks as soon as there is no Itemid. |
There should be menu ID always. Since Joomla 4 is in development, developers will have enough time to adjust its code for this transition and users will benefit from it. @csthomas only components affected by this in joomla 3.8.4 are for example kunena, jomsocial and similar ones which didn't have menu ids for their links/menus etc. (except main links) and believe me when I say not having menu ids is simply wrong and when menu id is there we can do so much more as users. Keep the menu id rule in J4 it will be truly beneficial. Thank you! |
This is a specific case which can be solved by not using JRoute for the redirect. |
@Cyrusxxx do you really think all developers will update their extensions? This is the same exact case as forcing the Strict Mode in the MySQLi Driver. If all this were to happen, then Joomla 4 would support less than 10% of the currently stable third party extensions for Joomla <= 3.8.3.
@Cyrusxxx IMO, there is no CMS that has such a perfect and complete framework like Joomla. However, it looks like third party extensions are no longer that important to Joomla, or at least to some people. |
That's wrong too IMO. If we can't rely on the router to build correct URLs, there are bigger issues and bypassing it is just yet another workaround, not a fix. |
@alessio-gaggii I still think that J4 should go forward with this and I think that developers would update their extensions to be compatible. @alessio-gaggii - WP introduced the Shortcode API syntax in v2.8 (May 2008) Yes that is true, but in 2015 for example when WP 4.2.3 was released for some security issues (I cant remember exact details) half of those shortcodes for example were not working after WP update and what happened next 3rd party developers updated plugins to be compatible. |
But joomla has com_tags router which work in that way. |
UPDATED Because there are a lot of people here who want to go back to URL routing from 3.8.3, I suggest to test (reversion in com_content / archive) #19561 before releasing incoming version 3.8.5. |
After the problematic changes was reverted in 3.8.5-rc, I will focus only on J4 in my answers but I may use examples from 3.x. I understand that you want to use inheritance of
The main change was,
If I will create once again my PR for J4 then you only need to remove |
I don't really see the benefit of removing |
Then I continue,
The article view has segments and we can create links like The archive view should also be able to use its own segments, like This two views (
but we also would like to use links like:
When we go to home page (featured view) then link to the article will be:
The problem starts when the article and its categories does not have any menu item Now we have links:
Link The parser of com_content will have a problem because it will try to interpreting At now the parser uses a workaround and ignore view of menu item What do you suppose to get when you are on
You may be surprised that instead of the list of articles from 2018 you get an article with ID=2018. The legacy router of
This is the reason why "views" should not inherit The conclusion is, the article view should not inherit I added an option of not inheriting |
How about you implement this in com_content's |
I can not do this (maybe I do not know how) only for com_content, the problem is general and should be fixed in
|
Look like this is not correct. I don't think we have to use modern routing for our extensions. The router class of our extensions just needs to implement build and parse method properly and it should still work well on J4 (Core component com_banners for example, still use old routing code and still work in J4) |
Yes. I got lost in version 4. |
The thing that absolutely is not supported in 4.0 is the old function based routers. You must have a class based router implementing the component's RouterInterface and this is done typically by extending either the RouterBase class (which basically just lets you copy/paste the code in your old function based routers into the methods required by that class) or the RouterView class (which is mostly the "modern" routing in core components). |
My custom component did suffer from this breaking change. :( . Anyway, I applied csthomas's guideline: removing the option parameter as suggested in his example.
I notice that JRoute does return the correct value, but when using that value as the form submit value (POST), I get a 303 "See other" code that redirects me towards "/component/customcomponent/?<myparameters>" Browsing to the url returned by JRoute works fine (GET). Did anything change concerning re-routing with that (breaking) change? |
@GiottoVerducci Joomla 3.8.5 has been released. Try it. |
As a third-party extension developer since Joomla 1.5, I have strived to develop following the rules. I haven't always achieved that. I am guilty, but sometimes I just didn't know how to do it. Coding for Joomla is very inconsistentI feel tired of adding if-elses to my code, just to be compatible with the various Joomla versions. I have clients with professional websites, running 2.5 until today (April 3, 2018). Is that correct? No, it isn't! But what can I do? I have told them many times to update their website, but people just postpone it. So, I am the one who is constantly in the middle. ProblemI tried routing a full link with ConclusionDo not set the Itemid to null, if the code is explicitly setting it. That will only cause more trouble. P.S.: Just for the sake of comparison, Android 4.2 was released in 2012, just like Joomla 2.5. Most new apps still work fine with that version, without much, if any, effort at all. |
I wrote a new PR #22229 for Joomla 4.
This problem has been fixed. |
I always want joomla URLs to be more deterministic.
The full link (with
option = ...
) should not depend on which page it was generated on.If you create a link without the
view
(or other required parameter is missing) likeJRoute::_('index.php?option=com_content')
then menu item won't be found.Itemid
should not be inherited for full link. Because of that some link will look like/component/content/article/1-category-without-menu-item/1-article-and_category-tree-without-menu-item
Partial link like
index.php?view=article&id=1
,&start=2
or onlyindex.php
have to inheritItemid
as it was before.These two rules I underscored in version 3.8.4 but it seems it was too early or should not happen.
The main question
Can we stay with these changes in version 4.0 or we have to revert it too?
The text was updated successfully, but these errors were encountered: