Ready to take over ? Failure

User tests: Successful: Unsuccessful:

avatar ggppdk
ggppdk
19 Mar 2018

More complete alternative to Pull Request #19516

Summary of Changes

During building menu item lookup table
when a menu item that has a layout is encountered, then 2 entries are added to the lookup table:

  • [$view . $layout] ....... (an exact match for URLs that specify layout variable
  • [$view] .......................... (a "fallback entry" in the case of URL without layout variable)

but the above causes later added (to the lookup table) menu items for the specific $view,
that do not specify a 'layout' to be ignored, as the "fallback entry" is not overwritten


PR #19516, suggests to remove the fallback entry, but then ... we have no fallback entry when needed

  • this PR will add a distinct fallback 3rd entry indexed via ... [$view . ':default'] to be tried last

Order of checking the menu item lookup table

  1. [$view . $layout] ....... Same as before this PR, created when a menu item with layout is encountered
  2. [$view] ......................... Change, this entry is now added ONLY by menu items without 'layout'
  3. [$view . ':default'] ..... New, entry is added the first time that a menu item with layout is encountered

NOTE:
The lookup code is exactly to what it was before, just the exact same code is moved inside a loop that iterates (in order) the above 3 cases ! Please see that is identical here:
https://github.com/ggppdk/joomla-cms/blob/30f86c8133dd226d7a8da908ba4baf6d2a3f403e/libraries/src/Component/Router/Rules/MenuRules.php#L131-L149

Testing Instructions

Expected result

Actual result

Documentation Changes Required

None

avatar ggppdk ggppdk - open - 19 Mar 2018
avatar ggppdk ggppdk - change - 19 Mar 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Mar 2018
Category Libraries
avatar ggppdk ggppdk - change - 19 Mar 2018
Title
Proper fallback when selecting menu item that have do not layouts
Proper selection of menu item, for URLs that do not specify a layout, but menu items both with and without layout exist
avatar ggppdk ggppdk - edited - 19 Mar 2018
avatar ggppdk ggppdk - change - 19 Mar 2018
Title
Proper fallback when selecting menu item that have do not layouts
Proper selection of menu item, for URLs that do not specify a layout, but menu items both with and without layout exist
avatar ggppdk ggppdk - change - 19 Mar 2018
Labels Added: ?
191c7c2 19 Mar 2018 avatar ggppdk Tests
avatar joomla-cms-bot joomla-cms-bot - change - 19 Mar 2018
Category Libraries Libraries Unit Tests
61fff68 19 Mar 2018 avatar ggppdk Tests
avatar ggppdk ggppdk - change - 19 Mar 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 19 Mar 2018
Category Libraries Unit Tests Libraries
12ce4a8 19 Mar 2018 avatar ggppdk CS
avatar ggppdk ggppdk - change - 19 Mar 2018
Labels Removed: ?
avatar csthomas
csthomas - comment - 19 Mar 2018

It would be good to add one unit test to protect this functionality. I did a code review and it looks OK.

avatar ggppdk
ggppdk - comment - 19 Mar 2018

It would be good to add one unit test to protect this functionality. I did a code review and it looks OK.

Yes indeed, 1 more test unit would be nice,
when i get a clear mind again will try to add it, too late night now

if you can suggest a test please do as i am not sure what the new test should be

30f86c8 19 Mar 2018 avatar ggppdk CS
avatar csthomas
csthomas - comment - 19 Mar 2018

You may add additional menu item with layout to test below or above

.

I did similar at PR #18260

avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar ggppdk ggppdk - change - 20 Mar 2018
The description was changed
avatar ggppdk ggppdk - edited - 20 Mar 2018
avatar csthomas
csthomas - comment - 20 Mar 2018

Returning to the original issue from #19943 and check below:

  1. Create a menu item A for com_content with category list (layout=default)
  2. Create a menu item B for com_contnet with category blog (layout=blog)

Before PR (single language) for category links we get the B item.
After PR we get the A item.

I understand that this PR was designed to do that, but J3 is probably not ready for that.

avatar ggppdk
ggppdk - comment - 20 Mar 2018

It is as @csthomas wrote above

avatar fancyFranci
fancyFranci - comment - 23 Mar 2018

I have tested this item successfully on 30f86c8

Tested on a multilingual and a normal page.
echo JRoute::_('index.php?option=com_content&view=category&id=8&layout=default');
echo JRoute::_('index.php?option=com_content&view=category&id=8');
echo JRoute::_('index.php?option=com_content&view=category&id=8&layout=blog');

before patch:
/joomla/index.php/blog
/joomla/index.php/blog
/joomla/index.php/blog

after patch:
/joomla-39/index.php/list
/joomla-39/index.php/list
/joomla-39/index.php/blog


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19945.

avatar FPerisa FPerisa - test_item - 23 Mar 2018 - Tested successfully
avatar ggppdk
ggppdk - comment - 16 Jul 2018

Thanks anyone spending time on this PR
No interest in spending more on it by me

avatar ggppdk ggppdk - close - 16 Jul 2018
avatar ggppdk ggppdk - close - 16 Jul 2018
avatar ggppdk ggppdk - change - 16 Jul 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-07-16 05:36:52
Closed_By ggppdk
avatar ggppdk ggppdk - change - 20 Jul 2018
Status Closed New
Closed_Date 2018-07-16 05:36:52
Closed_By ggppdk
avatar ggppdk ggppdk - change - 20 Jul 2018
Status New Pending
avatar ggppdk ggppdk - reopen - 20 Jul 2018
avatar ggppdk ggppdk - reopen - 20 Jul 2018
avatar gostn
gostn - comment - 24 Nov 2020

set label ´Needs New Owner´.

avatar laoneo
laoneo - comment - 20 Mar 2022

I'm closing this pr as the author has no further time for it. If somebody wants to take it over please make a new pull request on the 4.2 branch. @ggppdk thanks for your time and for your contribution, really appreciated.

avatar laoneo laoneo - close - 20 Mar 2022
avatar laoneo laoneo - change - 20 Mar 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-03-20 11:07:45
Closed_By laoneo
Labels Added: Ready to take over ?
Removed: ?

Add a Comment

Login with GitHub to post a comment