From 0540f8295074d5128000da9d4dbac1d338bb3f4b Mon Sep 17 00:00:00 2001 From: "Sebastian G. Marinescu" Date: Tue, 29 Aug 2023 22:01:22 +0200 Subject: [PATCH] Optionally pin "installer-entry" to top (#16435) * Update transport.core.system_settings.php Add `package_installer_at_top` system setting * Add lexicon-entry for package_installer_at_top * Update modMenu.php, add if-clause for package_installer_at_top * Update modMenu.php / Fixing Code-Quality * Update core/lexicon/en/setting.inc.php Co-authored-by: Jim Graham * Update _build/data/transport.core.system_settings.php Co-authored-by: Jim Graham --------- Co-authored-by: Jim Graham --- _build/data/transport.core.system_settings.php | 9 +++++++++ core/lexicon/en/setting.inc.php | 3 +++ core/src/Revolution/modMenu.php | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/_build/data/transport.core.system_settings.php b/_build/data/transport.core.system_settings.php index d0309aa6a72..9b515667130 100644 --- a/_build/data/transport.core.system_settings.php +++ b/_build/data/transport.core.system_settings.php @@ -1073,6 +1073,15 @@ 'area' => 'language', 'editedon' => null, ], '', true, true); +$settings['package_installer_at_top'] = $xpdo->newObject(modSystemSetting::class); +$settings['package_installer_at_top']->fromArray([ + 'key' => 'package_installer_at_top', + 'value' => true, + 'xtype' => 'combo-boolean', + 'namespace' => 'core', + 'area' => 'manager', + 'editedon' => null, +], '', true, true); $settings['principal_targets'] = $xpdo->newObject(modSystemSetting::class); $settings['principal_targets']->fromArray([ 'key' => 'principal_targets', diff --git a/core/lexicon/en/setting.inc.php b/core/lexicon/en/setting.inc.php index c1ffa89f495..f32fe065cc7 100644 --- a/core/lexicon/en/setting.inc.php +++ b/core/lexicon/en/setting.inc.php @@ -471,6 +471,9 @@ $_lang['setting_new_folder_permissions'] = 'New Folder Permissions'; $_lang['setting_new_folder_permissions_desc'] = 'When creating a new folder in the File Manager, the File Manager will attempt to change the folder permissions to those entered in this setting. This may not work on some setups, such as IIS, in which case you will need to manually change the permissions.'; +$_lang['setting_package_installer_at_top'] = 'Pin Package-Installer at top'; +$_lang['setting_package_installer_at_top_desc'] = 'If enabled, the Installer entry will be pinned to the top of the Extras menu. Otherwise it will be positioned according to its menuindex.'; + $_lang['setting_parser_recurse_uncacheable'] = 'Delay Uncacheable Parsing'; $_lang['setting_parser_recurse_uncacheable_desc'] = 'If disabled, uncacheable elements may have their output cached inside cacheable element content. Disable this ONLY if you are having problems with complex nested parsing which stopped working as expected.'; diff --git a/core/src/Revolution/modMenu.php b/core/src/Revolution/modMenu.php index 2108f77735a..15575188881 100644 --- a/core/src/Revolution/modMenu.php +++ b/core/src/Revolution/modMenu.php @@ -132,6 +132,12 @@ public function getSubMenus($start = '') $c->where([ 'modMenu.parent' => $start, ]); + + if ($this->xpdo->getOption('package_installer_at_top', null, true)) { + // make sure installer is always on top + $c->sortby('FIELD(modMenu.text, "installer")', 'DESC'); + } + $c->sortby($this->xpdo->getSelectColumns(modMenu::class, 'modMenu', '', ['menuindex']), 'ASC'); $menus = $this->xpdo->getCollection(modMenu::class, $c); if (count($menus) < 1) {