Skip to content

Commit

Permalink
force client in menu item parent
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepereiradasilva committed Jul 29, 2016
1 parent 9d7f941 commit 6032c93
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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'))
{
Expand Down
1 change: 1 addition & 0 deletions administrator/components/com_menus/models/forms/item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
description="COM_MENUS_ITEM_FIELD_PARENT_DESC"
default="1"
filter="int"
clientid="0"
size="1">
<option
value="1">COM_MENUS_ITEM_ROOT</option>
Expand Down

0 comments on commit 6032c93

Please sign in to comment.