diff --git a/Classes/Controller/TableOfContentsController.php b/Classes/Controller/TableOfContentsController.php index 7a7355418c..7840f8299c 100644 --- a/Classes/Controller/TableOfContentsController.php +++ b/Classes/Controller/TableOfContentsController.php @@ -241,7 +241,7 @@ protected function resolveMenuEntry($entry) /** * Get translated type of entry. - * + * * @param array $type * @return string */ @@ -251,7 +251,7 @@ private function getTranslatedType($type) { /** * Set title from entry. - * + * * @param array $entry * @return string */ @@ -268,26 +268,29 @@ private function setTitle($entry) { } /** - * Sort menu by orderlabel - currently implemented for newspaper. - * + * Sort menu by orderlabel. + * * @param array &$menu * @return void */ private function sortMenu(&$menu) { if ($menu[0]['type'] == $this->getTranslatedType("newspaper")) { - $this->sortMenuForNewspapers($menu); + $this->sortSubMenu($menu); + } + if ($menu[0]['type'] == $this->getTranslatedType("year")) { + $this->sortSubMenu($menu); } } /** - * Sort menu years of the newspaper by orderlabel. - * + * Sort sub menu e.g years of the newspaper by orderlabel. + * * @param array &$menu * @return void */ - private function sortMenuForNewspapers(&$menu) { - usort($menu[0]['_SUB_MENU'], function ($firstYear, $secondYear) { - return $firstYear['orderlabel'] <=> $secondYear['orderlabel']; + private function sortSubMenu(&$menu) { + usort($menu[0]['_SUB_MENU'], function ($firstElement, $secondElement) { + return $firstElement['orderlabel'] <=> $secondElement['orderlabel']; }); } }