diff --git a/administrator/components/com_menus/Helper/MenusHelper.php b/administrator/components/com_menus/Helper/MenusHelper.php index f07707ddad3ca..efc43a05dc004 100644 --- a/administrator/components/com_menus/Helper/MenusHelper.php +++ b/administrator/components/com_menus/Helper/MenusHelper.php @@ -488,7 +488,7 @@ protected static function installPresetItems(&$items, $menutype, $parent = 1) 'browserNav' => $item->browserNav ? 1 : 0, 'img' => $item->class, 'access' => $item->access, - 'component_id' => array_search($item->element, $components), + 'component_id' => array_search($item->element, $components) ?: 0, 'parent_id' => $parent, 'client_id' => 1, 'published' => 1, diff --git a/administrator/components/com_menus/presets/joomla.xml b/administrator/components/com_menus/presets/joomla.xml index 7543770fc2133..f261a5915f29a 100644 --- a/administrator/components/com_menus/presets/joomla.xml +++ b/administrator/components/com_menus/presets/joomla.xml @@ -116,7 +116,7 @@ sql_where="a.client_id = 0" sql_leftjoin="#__menu AS m ON m.menutype = a.menutype AND m.home = 1 LEFT JOIN #__languages AS l ON l.lang_code = m.language" sql_group="a.id, a.title, a.menutype, m.language, l.image" - sql_order="a.title ASC"> + sql_order="a.id DESC"> + sql_order="id DESC"> + sql_order="a.id DESC"> + sql_order="id DESC"> _unlock(); - if ($this->hasField('published')) + if ($result && $this->hasField('published')) { $this->recursiveUpdatePublishedColumn($this->$k); }