From abf20833e475151d730cad728a0e1160ee510f07 Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Mon, 3 Jul 2023 17:42:31 +0200 Subject: [PATCH] Update sorting to use year when orderlabel is empty --- Classes/Controller/TableOfContentsController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Classes/Controller/TableOfContentsController.php b/Classes/Controller/TableOfContentsController.php index 21f08e733e..a9b36b95fa 100644 --- a/Classes/Controller/TableOfContentsController.php +++ b/Classes/Controller/TableOfContentsController.php @@ -329,7 +329,10 @@ private function sortMenu(&$menu) { */ private function sortSubMenu(&$menu) { usort($menu[0]['_SUB_MENU'], function ($firstElement, $secondElement) { - return $firstElement['orderlabel'] <=> $secondElement['orderlabel']; + if (!empty($firstElement['orderlabel'])) { + return $firstElement['orderlabel'] <=> $secondElement['orderlabel']; + } + return $firstElement['year'] <=> $secondElement['year']; }); } }