[Modern Routing] make a simpler loop in StandardRules::build#19012
[Modern Routing] make a simpler loop in StandardRules::build#19012csthomas wants to merge 3 commits intojoomla:stagingfrom
Conversation
this is be done by applying PR or manually? |
|
Manually, To create a test example (in order to not install a separate component) I created a custom configuration for For such custom configuration, the link to the top category should look like You do not need to click on that link because it has not work yet (parse method has not support such custom configuration yet) and returns error 404. I would like to leave it for another PR. For this PR I would like to change the loop to simpler and remove PHP notice. @joomdonation As you are familiar with |
|
@csthomas this is above my skills. |
|
But thanks for interest:) |
|
I have tested this item ✅ successfully on bf28ce6 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19012. |
| $view = $views[$element]; | ||
|
|
||
| if ($found) | ||
| if ($found === false && $item && $item->query['view'] === $element) |
There was a problem hiding this comment.
I think $item check is not needed here as we check and make sure it is not null in previous code already
|
@csthomas I think for this PR you should focus in make a simpler loop in StandardRules::build task only. That part is good and easier to understand compare to the original code. It will help testers easier to review the change and also easier for maintainer to review and merge. For adding support for new router configuration, I would leave it for the next PR as I am unsure if it needed for now (and as you mentioned, the generated link causes 404 error anyway). The routing code is quite complex, so I prefer small step at a time. |
|
Ok. When I have more time to think about it I will fix it. |
|
I close it in favour of #19271 |
Summary of Changes
Replace the old complex loop with a simpler one.
Remove PHP notice.
Everything should work as before.
This PR adds a way to build correct URL for below structure:
Testing Instructions
Install Joomla with sample data testing.
After you replace php code in
com_content/router.phpas describer above:index.php/component/content/categories/and compare link to category view before and after patch.Expected result
No PHP notices.
Link to the top category view should be like
/featured-articles/14-sample-data-articlesActual result
There is a
PHP Notice: Undefined index id on line 265.Documentation Changes Required
No