User tests: Successful: Unsuccessful:
Pull Request for Issue #17719 and #16774
If link Itemid is equal to active menu and link query is equal to active query then use it, do not try to find a better match.
Add unit tests to prove that.
Use tests from #17719 or #16774 or this below.
Active second menu item (Style 2) should have URL to (Style 2)
Active second menu item (Style 2) use first menu item URL (Style 1)
No
Category | ⇒ | Libraries Unit Tests |
Status | New | ⇒ | Pending |
I have tested this item
@infograf768
it must be because of:
#18260 (comment)
Labels |
Added:
?
?
|
Thanks @ggppdk @infograf768
PR #17746 after the last commit is broken for this test.
I added a new commit. I tested an article with menu styles with success.
Please test again.
At first sight, it was working OK, i.e. I got unique itemids for each of the menu items, even when clicking again on the same menu... but when clicking on the category link in the Article Info Category link, I get
[08-Oct-2017 16:12:19 Europe/Berlin] PHP Warning: explode() expects parameter 2 to be string, array given in /Applications/MAMP/htdocs/testnew/trunkgitnew/libraries/src/Component/Router/Rules/MenuRules.php on line 83
The problem was filter_key
that is an array in category view.
As filter_key
is not a part of routing then I use now only option, view, key (usual it is id) and layout.
@csthomas
Your last changes solve the category display warning, but we still have an error.
Test:
Create a menu item of type Create an article
Create a menu item of type Login form
with option set to redirect to the Create an article
menu item.
Login via this login form. url is here http://localhost:8888/testnew/trunkgitnew/index.php?option=com_users&view=login&Itemid=135&lang=en
Login is done OK, but I get a notice:
[09-Oct-2017 10:46:22 Europe/Berlin] PHP Notice: Undefined index: a_id in /Applications/MAMP/htdocs/testnew/trunkgitnew/libraries/src/Component/Router/Rules/MenuRules.php on line 103
The Notice is the same in multilang whether the redirect is set to a Create an article
tagged to the same language as the login form or to another language.
In fact clicking directly on the Create article
menu item also sends the Notice.
URL is:
http://localhost:8888/testnew/trunkgitnew/index.php?option=com_content&view=form&layout=edit&a_id=0&Itemid=134&lang=en
TBH, I am a bit concerned about B/C here.
I have only tested stuff concerning com_content, but are'nt we going to find other issues in other extensions, including 3rd party?
There is still an issue with B/C now.
Last commit solved the Notice for Create Article
menu item.
As I can not use $view->key
because it is only in newer routing I back to simpler way and only compare strings, if in query has array then this PR change nothing.
Current version does not work for category view because category view has query parameter filter_tag that is not used in build lookup. I can add a workaround for that by adding code in loop
if (strpos($k, 'filter_') === 0) continue;
that will ignore every filter parameters.
What I remarked (and I do not see how to solve that aspect except by a new parameter), is that
Joomla routing is not a simple path.
Version for monolingual (If you do not use language parameter):
lang=...
):This is very weird but probably there ware some B/C issue.
The code is at https://github.com/joomla/joomla-cms/blob/staging/libraries/src/Component/Router/Rules/MenuRules.php#L206 - the trick one
[Deleted]
...
- same for a link to a category in the article info when one has 2 single category menu items.
Example a category blog has itemid 117 and category list or blog is itemid 136, then 136 will display.
[Updated]
It would be good to add new column/field "Routing Priority" to each menu item. This way we can manage which menu item (category menu) should be used for routing
After that you can set higher priority for menu item 117.
Then only first category menu will be used for articles routing.
Going back to this PR,
If someone care about category view then such improvement could be add later.
What is the exact issue you have with category view?
I'm surprised that it works for category menus.
Ok, then It is completed. Please test.
I have tested this item
No more Notices or warnings.
Modules assignment work fine.
I have tested this item
@franz-wohlkoenig, done
Status | Pending | ⇒ | Ready to Commit |
RTC after two successful tests.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-10-15 15:53:25 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
|
@arrowthemes @weeblr
This small patch should fix your issues and it has chance to be merged in J3.8.x than my previous one #17746 that won't be merged in J3.8
To test you have to replace only one file
libraries/src/Component/Router/Rules/MenuRules.php
.