From 6032c93502690308287ce3952ee6b69440a7a337 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Fri, 29 Jul 2016 17:29:05 +0100 Subject: [PATCH 1/2] force client in menu item parent --- .../components/com_menus/models/fields/menuparent.php | 9 +++++++++ administrator/components/com_menus/models/forms/item.xml | 1 + 2 files changed, 10 insertions(+) diff --git a/administrator/components/com_menus/models/fields/menuparent.php b/administrator/components/com_menus/models/fields/menuparent.php index 6f247e912c7ae..a1756de7e44ef 100644 --- a/administrator/components/com_menus/models/fields/menuparent.php +++ b/administrator/components/com_menus/models/fields/menuparent.php @@ -43,6 +43,7 @@ protected function getOptions() ->from('#__menu AS a') ->join('LEFT', $db->quoteName('#__menu') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); + // Filter by menu type. if ($menuType = $this->form->getValue('menutype')) { $query->where('a.menutype = ' . $db->quote($menuType)); @@ -52,6 +53,14 @@ protected function getOptions() $query->where('a.menutype != ' . $db->quote('')); } + // Filter by client id. + $clientId = $this->getAttribute('clientid', null); + + if (!is_null($clientId)) + { + $query->where($db->quoteName('a.client_id') . ' = ' . (int) $clientId); + } + // Prevent parenting to children of this item. if ($id = $this->form->getValue('id')) { diff --git a/administrator/components/com_menus/models/forms/item.xml b/administrator/components/com_menus/models/forms/item.xml index bb4b79469af69..f6813766a00a7 100644 --- a/administrator/components/com_menus/models/forms/item.xml +++ b/administrator/components/com_menus/models/forms/item.xml @@ -95,6 +95,7 @@ description="COM_MENUS_ITEM_FIELD_PARENT_DESC" default="1" filter="int" + clientid="0" size="1"> From 07369655f4f563a508fb0d8c1b5f4cc009d99d06 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Fri, 29 Jul 2016 17:40:41 +0100 Subject: [PATCH 2/2] null is the defaul value so we son't need it --- administrator/components/com_menus/models/fields/menuparent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_menus/models/fields/menuparent.php b/administrator/components/com_menus/models/fields/menuparent.php index a1756de7e44ef..13a94eefce7f1 100644 --- a/administrator/components/com_menus/models/fields/menuparent.php +++ b/administrator/components/com_menus/models/fields/menuparent.php @@ -54,7 +54,7 @@ protected function getOptions() } // Filter by client id. - $clientId = $this->getAttribute('clientid', null); + $clientId = $this->getAttribute('clientid'); if (!is_null($clientId)) {