mirror of
https://github.com/flarum/core.git
synced 2025-07-30 21:20:24 +02:00
Fix error when there are no orders on the query
This commit is contained in:
@@ -15,6 +15,10 @@ class StickySearchModifier
|
||||
if ($event->criteria->sort === null) {
|
||||
$query = $event->searcher->query();
|
||||
|
||||
if (!is_array($query->orders)) {
|
||||
$query->orders = [];
|
||||
}
|
||||
|
||||
foreach ($event->searcher->getActiveGambits() as $gambit) {
|
||||
if ($gambit instanceof CategoryGambit) {
|
||||
array_unshift($query->orders, ['column' => 'is_sticky', 'direction' => 'desc']);
|
||||
|
Reference in New Issue
Block a user