From 7bc62610a3c5d572e81788051b82fdcf6f963830 Mon Sep 17 00:00:00 2001 From: Yves Torres Date: Sat, 11 Mar 2023 11:20:11 +0100 Subject: [PATCH] Feature/allow article list sorting (#5622) --- redaxo/src/addons/structure/pages/index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/redaxo/src/addons/structure/pages/index.php b/redaxo/src/addons/structure/pages/index.php index afe3d799ed..95be3c6e39 100644 --- a/redaxo/src/addons/structure/pages/index.php +++ b/redaxo/src/addons/structure/pages/index.php @@ -339,6 +339,12 @@ $artAddLink = ''; } + $articleOrderBy = rex_extension::registerPoint(new rex_extension_point('PAGE_STRUCTURE_ARTICLE_ORDER_BY', 'priority, name', [ + 'category_id' => $structureContext->getCategoryId(), + 'article_id' => $structureContext->getArticleId(), + 'clang' => $structureContext->getClangId(), + ])); + // ---------- COUNT DATA $sql = rex_sql::factory(); // $sql->setDebug(); @@ -348,7 +354,7 @@ WHERE ((parent_id = :category_id AND startarticle=0) OR (id = :category_id AND startarticle=1)) AND clang_id = :clang_id - ORDER BY priority, name + ORDER BY ' . $articleOrderBy . ' ', [ 'category_id' => $structureContext->getCategoryId(), 'clang_id' => $structureContext->getClangId(), @@ -371,7 +377,7 @@ ((parent_id = :category_id AND startarticle=0) OR (id = :category_id AND startarticle=1)) AND clang_id = :clang_id ORDER BY - priority, name + ' . $articleOrderBy . ' LIMIT ' . $artPager->getCursor() . ',' . $artPager->getRowsPerPage(), [ 'category_id' => $structureContext->getCategoryId(),