Skip to content

Commit

Permalink
Optionally pin "installer-entry" to top (#16435)
Browse files Browse the repository at this point in the history
* 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 <info@sparkmediagroup.com>

* Update _build/data/transport.core.system_settings.php

Co-authored-by: Jim Graham <info@sparkmediagroup.com>

---------

Co-authored-by: Jim Graham <info@sparkmediagroup.com>
  • Loading branch information
sebastian-marinescu and Jim Graham authored Aug 29, 2023
1 parent c4d7ac8 commit 0540f82
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions _build/data/transport.core.system_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions core/lexicon/en/setting.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.';

Expand Down
6 changes: 6 additions & 0 deletions core/src/Revolution/modMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0540f82

Please sign in to comment.