Skip to content

Commit

Permalink
[BUGFIX] Keep defined order for menus of type list
Browse files Browse the repository at this point in the history
If the special menu type 'list' is used, the order
must be kept as provided within the list configuration.

Resolves: #96577
Related: #96358
Releases: main, 11.5
Change-Id: I99a0f93b71836644bdeab8adecb3171090359fab
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73083
Tested-by: core-ci <typo3@b13.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
  • Loading branch information
georgringer authored and o-ba committed Jan 20, 2022
1 parent 983b219 commit 312e50c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,12 @@ protected function prepareMenuItemsForListMenu($specialValue)
$pageIds = GeneralUtility::intExplode(',', (string)$specialValue);
$disableGroupAccessCheck = !empty($this->mconf['showAccessRestrictedPages']);
$pageRecords = $this->sys_page->getMenuForPages($pageIds);
// After fetching the page records, restore the initial order by using the page id list as arrays keys and
// replace them with the resolved page records. The id list is cleaned up first, since ids might be invalid.
$pageRecords = array_replace(
array_flip(array_intersect(array_values($pageIds), array_keys($pageRecords))),
$pageRecords
);
$pageLinkBuilder = GeneralUtility::makeInstance(PageLinkBuilder::class, $this->parent_cObj);
foreach ($pageRecords as $row) {
$pageId = (int)$row['uid'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1337,19 +1337,19 @@ public function listMenuIsGeneratedDataProvider(): array
'Live' => [
'https://acme.us/',
1100,
[1100, 1600, 1700, 1800, 1520],
[1600, 1100, 1700, 1800, 1520],
0,
0,
[],
[
[
'title' => 'EN: Welcome',
'link' => '/welcome',
],
[
'title' => 'About us',
'link' => '/about',
],
[
'title' => 'EN: Welcome',
'link' => '/welcome',
],
[
'title' => 'Announcements & News',
'link' => '/news',
Expand All @@ -1359,19 +1359,19 @@ public function listMenuIsGeneratedDataProvider(): array
'Workspaces' => [
'https://acme.us/',
1100,
[1100, 1600, 1700, 1800, 1520],
[1600, 1100, 1700, 1800, 1520],
1,
1,
[],
[
[
'title' => 'EN: Welcome to ACME Inc',
'link' => '/welcome-modified',
],
[
'title' => 'About us',
'link' => '/about',
],
[
'title' => 'EN: Welcome to ACME Inc',
'link' => '/welcome-modified',
],
[
'title' => 'Announcements & News',
'link' => '/news',
Expand Down

0 comments on commit 312e50c

Please sign in to comment.