Feature #70964 » patchfile.patch
TYPO3.CMS.PATCHED/typo3/sysext/frontend/Classes/ContentObject/Menu/CategoryMenuUtility.php Thu Oct 22 22:36:02 2015 | ||
---|---|---|
protected function sortPages($pages, $order) {
|
||
// Perform the sorting only if a criterion was actually defined
|
||
if (!empty(self::$sortingField)) {
|
||
// Check that the sorting field exists (checking the first record is enough)
|
||
$firstPage = current($pages);
|
||
if (isset($firstPage[self::$sortingField])) {
|
||
// Make sure the order property is either "asc" or "desc" (default is "asc")
|
||
if (!empty($order)) {
|
||
$order = strtolower($order);
|
||
if ($order != 'desc') {
|
||
$order = 'asc';
|
||
// Shuffle pages if sorting is set to mysql randomize function
|
||
if ("rand()" == self::$sortingField) {
|
||
shuffle($pages);
|
||
}
|
||
else {
|
||
// Check that the sorting field exists (checking the first record is enough)
|
||
$firstPage = current($pages);
|
||
if (isset($firstPage[self::$sortingField])) {
|
||
// Make sure the order property is either "asc" or "desc" (default is "asc")
|
||
if (!empty($order)) {
|
||
$order = strtolower($order);
|
||
if ($order != 'desc') {
|
||
$order = 'asc';
|
||
}
|
||
}
|
||
uasort(
|
||
$pages,
|
||
array(
|
||
'\TYPO3\CMS\Frontend\ContentObject\Menu\CategoryMenuUtility',
|
||
'sortPagesUtility'
|
||
)
|
||
);
|
||
// If the sort order is descending, reverse the sorted array
|
||
if ($order == 'desc') {
|
||
$pages = array_reverse($pages, TRUE);
|
||
}
|
||
}
|
||
uasort(
|
||
$pages,
|
||
array(
|
||
'\TYPO3\CMS\Frontend\ContentObject\Menu\CategoryMenuUtility',
|
||
'sortPagesUtility'
|
||
)
|
||
);
|
||
// If the sort order is descending, reverse the sorted array
|
||
if ($order == 'desc') {
|
||
$pages = array_reverse($pages, TRUE);
|
||
}
|
||
}
|
||
}
|