Skip to content

Commit 5e5be1c

Browse files
authored
Merge pull request PrestaShop#41588 from nicosomb/sort-alpha-hook-list
2 parents ef73cc9 + e6fff4f commit 5e5be1c

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

admin-dev/themes/new-theme/js/pages/improve/design_positions/hook-module-handler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,12 @@ export default class HookModuleHandler {
105105
const currentValue = this.hookSelector.value;
106106
this.clearHookSelector();
107107

108-
const available = hooks.filter((hook) => !hook.registered);
109-
const registered = hooks.filter((hook) => hook.registered);
108+
// Sort by technical name (case-insensitive) so each group is alphabetical,
109+
// matching the order the option label leads with.
110+
const byName = (a: HookableInfo, b: HookableInfo): number => a.name.localeCompare(b.name, undefined, {sensitivity: 'base'});
111+
112+
const available = hooks.filter((hook) => !hook.registered).sort(byName);
113+
const registered = hooks.filter((hook) => hook.registered).sort(byName);
110114

111115
const buildOption = (hook: HookableInfo): HTMLOptionElement => {
112116
const option = document.createElement('option');

src/PrestaShopBundle/Controller/Admin/Improve/Design/PositionsController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ private function buildExceptionChoices(): array
501501
$entries[] = sprintf('module-%s-%s', $module, $controller);
502502
}
503503
}
504+
sort($entries);
504505

505506
return $entries;
506507
};

0 commit comments

Comments
 (0)