? Pending

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
28 Jan 2017

Pull Request for Issue #13783.
Replaces #13788 and #13787

Summary of Changes

Adding client_id checks to MenusHelper::getMenuLinks() so it returns only menus from frontend.
This method is used in core to fetch the menu items for the module and template "menu assignment" and by the JFormFieldMenuitem to get the menu item list.

Testing Instructions

  • Create a custom admin menu
  • Edit a module and a template and check the menu assignment tab. The custom admin menu should not appear in the list of menu items
  • Edit the "System - Page Cache" plugin and check that the custom admin menu doesn't appear in the "Exclude Menu Items" list.

Documentation Changes Required

None

avatar Bakual Bakual - open - 28 Jan 2017
avatar Bakual Bakual - change - 28 Jan 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Jan 2017
Category Administration com_menus
avatar Bakual
Bakual - comment - 28 Jan 2017

Imo, we should add this where only if the $menuType is not specified.

Why? Until now, the method only returned frontend menuitems, the backend wasn't returned (I think because there was no menutype for that menu). This PR keeps the behavior inline with the existing one while keeping the change dead simple.

If there is a need to retrieve backend menuitems in future, this method would need at least a client argument and possibly other adjustments as well. But that is beyong what I try to fix in this PR.

avatar infograf768
infograf768 - comment - 28 Jan 2017

wondering if the method will also be used for the pr to come letting choose the components to be displayed/hidden in the container menu item. @izharaazmi

avatar izharaazmi
izharaazmi - comment - 28 Jan 2017

Beyond the scope of this PR... Agreed.

avatar izharaazmi
izharaazmi - comment - 28 Jan 2017

@infograf768 Yes. That's exactly what I did in my current work. PR pending.
When that comes, this may anyway be changed.

avatar Bakual
Bakual - comment - 28 Jan 2017

If you plan to use it in backend, I can adjust this PR accordingly of course. I just don't want to invest time into something which then isn't used at all.

I think an added client attribute is actually all it needs and it then should retain all other functionality. Would that be sufficient for your usecase?

avatar izharaazmi
izharaazmi - comment - 28 Jan 2017

Please don't invest any time on this function. I've already coded it. :-)

avatar infograf768
infograf768 - comment - 29 Jan 2017

@izharaazmi do i understand well that we should wait your new pr and not merge this one?

avatar izharaazmi
izharaazmi - comment - 29 Jan 2017

Yes, I hope so. I'll send my PR very soon. We can wait a little.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 29 Jan 2017

I have tested this item successfully on 0c4cbf1


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

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 29 Jan 2017 - Tested successfully
avatar Bakual
Bakual - comment - 29 Jan 2017

do i understand well that we should wait your new pr and not merge this one?

This can also be merged and @izharaazmi can solve the merge conflicts afterwards (if any).
The code here needs to go in anyway.

avatar laoneo
laoneo - comment - 30 Jan 2017

I have tested this item successfully on 0c4cbf1


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

avatar laoneo laoneo - test_item - 30 Jan 2017 - Tested successfully
avatar infograf768
infograf768 - comment - 30 Jan 2017

@Bakual
To make it easier to @izharaazmi , would not it be better to patch this way?

diff --git a/administrator/components/com_menus/helpers/menus.php b/administrator/components/com_menus/helpers/menus.php
index c15ca1b..a8487e7 100644
--- a/administrator/components/com_menus/helpers/menus.php
+++ b/administrator/components/com_menus/helpers/menus.php
@@ -148,4 +148,8 @@
 	{
 		$db = JFactory::getDbo();
+
+		// Get site menu items per default
+		$clientId = 0;
+
 		$query = $db->getQuery(true)
 			->select('DISTINCT(a.id) AS value,
@@ -159,4 +163,5 @@
 					  a.checked_out,
 					  a.language,
+					  a.client_id,
 					  a.lft')
 			->from('#__menu AS a');
@@ -205,4 +210,5 @@
 
 		$query->where('a.published != -2');
+		$query->where('a.client_id = ' . $db->quote($clientId));
 		$query->order('a.lft ASC');
 
@@ -228,4 +234,5 @@
 				->from('#__menu_types')
 				->where('menutype <> ' . $db->quote(''))
+				->where('client_id = ' . $db->quote($clientId))
 				->order('title, menutype');
 			$db->setQuery($query);
avatar izharaazmi
izharaazmi - comment - 30 Jan 2017

@infograf768 Let it be that way. I will resolve any conflicts when
committing. Let's not bother him needlessly :)

avatar infograf768
infograf768 - comment - 30 Jan 2017

I have tested this item successfully on 0c4cbf1


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

avatar infograf768 infograf768 - test_item - 30 Jan 2017 - Tested successfully
avatar infograf768 infograf768 - change - 30 Jan 2017
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 30 Jan 2017

RTC. Thanks.

@rdeutz please merge


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

avatar rdeutz rdeutz - change - 30 Jan 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-01-30 08:19:41
Closed_By rdeutz
Labels Added: ?
avatar rdeutz rdeutz - close - 30 Jan 2017
avatar rdeutz rdeutz - merge - 30 Jan 2017

Add a Comment

Login with GitHub to post a comment