Skip to content

Commit

Permalink
Prevent pagination on entries and terms fields when in select mode. C…
Browse files Browse the repository at this point in the history
…loses #1727
  • Loading branch information
jasonvarga committed Oct 20, 2020
1 parent e31b0c8 commit 7bd4f77
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion resources/js/components/inputs/relationship/SelectField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export default {
parameters() {
return {
site: this.site
site: this.site,
paginate: false
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion src/Fieldtypes/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Statamic\Http\Resources\CP\Entries\Entries as EntriesResource;
use Statamic\Http\Resources\CP\Entries\Entry as EntryResource;
use Statamic\Query\Scopes\Filters\Concerns\QueriesFilters;
use Statamic\Support\Str;

class Entries extends Relationship
{
Expand Down Expand Up @@ -70,7 +71,11 @@ public function getIndexItems($request)
$query->orderBy($sort, $this->getSortDirection($request));
}

return $query->paginate()->preProcessForIndex();
$shouldPaginate = $request->has('paginate') ? Str::toBool($request->paginate) : true;

$items = $shouldPaginate ? $query->paginate() : $query->get();

return $items->preProcessForIndex();
}

public function getResourceCollection($request, $items)
Expand Down
4 changes: 3 additions & 1 deletion src/Fieldtypes/Terms.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ public function getIndexItems($request)
$query->orderBy($sort, $this->getSortDirection($request));
}

return $query->paginate();
$shouldPaginate = $request->has('paginate') ? Str::toBool($request->paginate) : true;

return $shouldPaginate ? $query->paginate() : $query->get();
}

public function getResourceCollection($request, $items)
Expand Down

0 comments on commit 7bd4f77

Please sign in to comment.