[BUG]: RouteHelper not producing correct urls #1208
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What Happened?
I attempt to create a listing similar to the Looks listing in the demo. Instead of the site view named Looking I have Worldview.
So in my RouteHelper, I have a getWorldviewRoute method instead of a getLookingRoute method.
I attempt to generate my urls list in the same way, calling RouteHelper::getWorldviewRoute($item->slug);
It is generating an error Illegal offset type in isset or empty(JROOT/libraries/src/Menu/AbstractMenu.php:164 )
It seems that this problem is caused from using view=worldview in the link instead of task=worldview. To confirm this I can see a proper page using this url with task instead of view:
http://localhost:8080/index.php?option=com_threedbug&task=worldview&id=1
The other issue is that even when changing view to task in the RouteHelper, the URLs are still not correct once the Route class converts them. They output as one of the following, depending on if I have url rewriting enabled:
http://localhost:8080/worlds?task=worldview&id=1:one1
http://localhost:8080/index.php/worlds?task=worldview&id=1:one1
http://localhost:8080/index.php?option=com_threedbug&task=worldview&id=1:one1&Itemid=1118
Steps to reproduce the Bug
Set up a new component using similar site & admin views to Look, Looks, Looking.
Ensure the site view has a similar listing method using RouteHelper.
Create a menu item to the Looks equivalent.
Which Joomla version are you compiling in?
5.2.4
Which PHP version are you compiling in?
8.2.23
Which Joomla versions are you targeting?
5
Which PHP version are you targeting?
8.2.23
Which Web server is JCB running on?
Joomla Docker image. Apache 2
Which Relational Database is JCB running on?
mysqlnd 8.2.23
Which OS is JCB running on?
Alpine linux
Which JCB version are you using?
5.1.0
Where in JCB did this issue occur?
No response
On which browsers did you encounter the issue?
No response
Additional Comments
No response
Open the new router builder area:

Choose the code options, and write your own implementation... it can be as complex as:
We have added this new area, since this can be to many options to automate correctly.
Thanks. Working from example code often works well for me!