Skip to content

Commit

Permalink
Update sorting to use year when orderlabel is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrycze-volk committed Jul 3, 2023
1 parent 509cc26 commit abf2083
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Classes/Controller/TableOfContentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
});
}
}

0 comments on commit abf2083

Please sign in to comment.