Skip to main content

GravityKit\GravityView\Search\Querying\SearchFreeRequest

A request with the Search Bar's arguments stripped out.

Handing the View this request makes it answer with everything it narrows by except what the Search Bar adds, the visitor's input and the bar's default values alike, so a range control can describe the View's entries rather than the current search.

Since: 3.9.0

Source: src/Search/Querying/SearchFreeRequest.php:16

Details​

  • Kind: class
  • Namespace: GravityKit\GravityView\Search\Querying
  • Extends: Request

Methods​

MethodDescription
wrapping()Returns the given request with its search-bar arguments removed.
get_arguments()Returns the arguments this request carries.
is_search_pristine()Whether this request is pristine for the given View: no search-bar argument, empty or
is_renderable()Whether this request is something that is renderable.
is_view()The current $post is a View, no?
is_entry()Checks whether this is a single entry request
is_edit_entry()Checks whether this an edit entry request.

Method Reference​

wrapping()​

public static function wrapping( Request $request ): self

Returns the given request with its search-bar arguments removed.

Parameters​

NameTypeDefaultDescription
$requestRequestThe request being answered.

Returns​

  • self — The search-free request.

Since: 3.9.0

Source: src/Search/Querying/SearchFreeRequest.php:48

get_arguments()​

public function get_arguments(): array

Returns the arguments this request carries.

Defaults to the ambient HTTP request, read from the superglobal the configured search method names rather than the HTTP verb. Transports that transmit their own arguments (CLI, a mocked render) override this, and their answer is authoritative even when empty.

Returns​

  • array<string, — mixed> The arguments.

Since: 3.9.0

Source: src/Search/Querying/SearchFreeRequest.php:57

is_search_pristine()​

public function is_search_pristine( $view ): bool

Whether this request is pristine for the given View: no search-bar argument, empty or

Never pristine: a pristine request is answered with the Search Bar's default values, and this request stands for the View without its Search Bar.

Parameters​

NameTypeDefaultDescription
$view\GravityKit\GravityView\View\View | intThe View, or its ID.

Returns​

  • bool

Since: 3.9.0

Source: src/Search/Querying/SearchFreeRequest.php:69

is_renderable()​

public function is_renderable()

Whether this request is something that is renderable.

Returns​

  • bool — Yes or no.

Since: 3.9.0

Source: src/Search/Querying/SearchFreeRequest.php:78

is_view()​

public function is_view( $return_view=true )

The current $post is a View, no?

Parameters​

NameTypeDefaultDescription
$return_viewbooltrueWhether to return a View object or boolean.

Returns​

  • \GV\View | bool — If the global $post is a View, returns the View or true, depending on $return_view. If not a View, returns false.

Since: 3.9.0

Source: src/Search/Querying/SearchFreeRequest.php:87

is_entry()​

public function is_entry( $form_id=0 )

Checks whether this is a single entry request

Parameters​

NameTypeDefaultDescription
$form_idint0The form ID, since slugs can be non-unique. Default: 0.

Returns​

  • \GV\GF_Entry | false — The entry requested or false.

Since: 3.9.0

Source: src/Search/Querying/SearchFreeRequest.php:96

is_edit_entry()​

public function is_edit_entry( $form_id=0 )

Checks whether this an edit entry request.

Parameters​

NameTypeDefaultDescription
$form_idint0The form ID, since slugs can be non-unique. Default: 0.

Returns​

  • \GV\Entry | false — The entry requested or false.

Since: 3.9.0

Source: src/Search/Querying/SearchFreeRequest.php:105