Modifying the entries displayed in a View
GravityView fetches entries using the gravityview_get_entries()
function
The gravityview_get_entries()
is a wrapper for the GVCommon::get_entries()
method.
GravityView uses GVCommon::get_entries()
as a wrapper to generate a request before sending it to Gravity Forms' GFAPI::get_entries()
. This way, we can add lots of nice filters, provide caching functionality, and ensure the search is generated properly.
The method has two filters: gravityview_search_criteria
and gravityview_entries
.
The gravityview_search_criteria
filter
Modify the arguments used to generate the search. These arguments are also used to generate the cache key.
$criteria
- Search array with the following keys:search_criteria
- Array; seeGFAPI::get_entries()
method for detailssorting
- Array withkey
(field ID),direction
(ASC
orDESC
), andis_numeric
(boolean) keyspaging
- Array withoffset
andpage_size
keys. SeeGFAPI::get_entries()
cache
- Set to0
orfalse
to disable caching of results. Default:1
$form_ids
- The ID of the form or an array IDs of the forms. Zero (0
) for all forms.
The gravityview_entries
filter
Modify the array of entries returned to GravityView after it has been fetched from the cache or from GFAPI::get_entries()
.
$entries
array or null Array of entries as returned by the cache or byGFAPI::get_entries()
$criteria
array The final search criteria used to generate the request toGFAPI::get_entries()
$passed_criteria
array The original search criteria passed toGVCommon::get_entries()
$total
int or null Optional. An output parameter containing the total number of entries. Pass a non-null value to generate