Skip to main content

GravityKit\EntryTags\EntryTagQuery

Searches Entry Tags fields by whole tags, so "Bug" does not find "Bugfix".

Tags are stored as browser JSON, PHP JSON (escaped accents and slashes) or comma-separated text.

Since: 1.5.0

Source: src/EntryTagQuery.php:19

Details​

  • Kind: class
  • Namespace: GravityKit\EntryTags

Methods​

MethodDescription
register()Hooks the whole-tag search into GravityView and the Gravity Forms entries list.
add_condition_handler()Adds the Entry Tags handler to the Query Filters condition handlers that build GravityView searches.
get_filter_condition()Returns the whole-tag condition for a Query Filters filter on an Entry Tags field.
filter_entry_list_criteria()Swaps a tag link's search in the Gravity Forms entries list for the entries that have the whole tag.
filter_entry_list_args()Swaps a tag link's search for the entries that have the whole tag when entries are printed.

Method Reference​

register()​

public static function register(): void

Hooks the whole-tag search into GravityView and the Gravity Forms entries list.

Returns​

  • void

Since: 1.5.0

Source: src/EntryTagQuery.php:36

add_condition_handler()​

public static function add_condition_handler( $handlers ): array

Adds the Entry Tags handler to the Query Filters condition handlers that build GravityView searches.

It is added last, so the built-in handlers (such as a comparison with another field's value) go first.

Parameters​

NameTypeDefaultDescription
$handlersmixedThe condition handlers.

Returns​

  • array

Since: 1.5.0

Source: src/EntryTagQuery.php:53

get_filter_condition()​

public static function get_filter_condition( $filter )

Returns the whole-tag condition for a Query Filters filter on an Entry Tags field.

Parameters​

NameTypeDefaultDescription
$filterarrayThe filter, with key, value, operator and form_id.

Returns​

  • false | GF_Query_Condition — False when the filter is not a tag search this handles.

Since: 1.5.0 (Only positive matches are handled: a "does not have" match needs Query Filters' own check for entries without the field, which joined forms resolve differently.)

Source: src/EntryTagQuery.php:72

filter_entry_list_criteria()​

public static function filter_entry_list_criteria( $search_criteria, $form_id )

Swaps a tag link's search in the Gravity Forms entries list for the entries that have the whole tag.

Tag links search with is. A search typed into the entries list uses contains and stays a text match.

Parameters​

NameTypeDefaultDescription
$search_criteriaarrayThe entries list search criteria.
$form_idintThe form ID.

Returns​

  • array

Since: 1.5.0

Source: src/EntryTagQuery.php:105

filter_entry_list_args()​

public static function filter_entry_list_args( $args )

Swaps a tag link's search for the entries that have the whole tag when entries are printed.

Printing reads the search from the URL without stripping slashes. On the entries list the search was already swapped, so there is nothing left to swap.

Parameters​

NameTypeDefaultDescription
$argsarrayThe arguments used to get the entries, with form_id and search_criteria.

Returns​

  • array

Since: 1.5.0

Source: src/EntryTagQuery.php:122