Skip to content

Commit

Permalink
Feature/allow article list sorting (#5622)
Browse files Browse the repository at this point in the history
  • Loading branch information
ynamite committed Mar 11, 2023
1 parent 3be534e commit 7bc6261
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions redaxo/src/addons/structure/pages/index.php
Expand Up @@ -339,6 +339,12 @@
$artAddLink = '<a class="rex-link-expanded" href="' . $structureContext->getContext()->getUrl(['function' => 'add_art', 'artstart' => $structureContext->getArtStart()]) . '"' . rex::getAccesskey(rex_i18n::msg('article_add'), 'add_2') . '><i class="rex-icon rex-icon-add-article"></i></a>';
}

$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();
Expand All @@ -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(),
Expand All @@ -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(),
Expand Down

0 comments on commit 7bc6261

Please sign in to comment.