ExpressionEngine Docs

Helper functions

There are several helper functions and methods that will help you create your own filters. They are located in several files and objects.

pro_search_filter

The parent class is located in /pro_search/filter.pro_search.php. Use $this->_method_name_() in your filter class.

_get_field_id

Deprecated since v4.2.0. Use $this->fields->id() instead.

_get_where_search

Deprecated since v4.2.0. Use $this->fields->sql() instead.

_remove_rogue_vars

Removes unset variables from the template before EE does it. Useful if your vars could be input for other tags.

Arguments

_log

A shortcut for ee()->TMPL->log_item().

Arguments

pro_search_params

The library class is located in /pro_search/libraries/pro_search_params.php and mapped to $this->params. Use $this->params->_method_name_() in your filter class.

explode

Turns a multi-valued parameter string to an array.

Arguments

$str (string) — parameter to explode.

Returns

An array where the first value contains the exploded values and the second value is a boolean whether the parameter had not prefixed to it.

get

Gets all parameters for this search query, or a single one.

Arguments

Returns

All parameters if no key is given, the parameter value if present, or the fallback if not present.

get_prefixed

Gets all parameters where the name starts with given string.

Arguments

Returns

An associative array of the matching parameters.

in_param

Checks if given value is present in given parameter.

Arguments

Returns

Bool

prep

Modifies a parameter value to EE syntax based on the presence of the parameter name in other parameters like require_all or exclude.

Arguments

Returns

The modified value.

site_ids

Gets the current site IDs based on the site parameter.

Returns

An array of the current site IDs.

pro_search_fields

The library class is located in /pro_search/libraries/pro_search_fields.php and mapped to $this->fields. Use $this->fields->_method_name_() in your filter class.

id

Retrieves the field ID for the given custom field name.

Arguments

Returns

The field ID found, or 0 if no valid ID is found.

is_native

Determines whether given field name is native, ie. part of the exp_channel_titles table.

Arguments

Returns

TRUE or FALSE.

is_date

Determines whether given field name is a date field, custom or native.

Arguments

Returns

TRUE or FALSE.

is_grid

Determines whether given field name is a Grid field.

Arguments

Returns

TRUE or FALSE.

is_rel

Determines whether given field name is a Relationships field.

Arguments

Returns

TRUE or FALSE.

is__third_party_field_name_

Determines whether given field name is a third_party_field_name field, where that field uses var pair syntax. For example: is_matrix or is_playa.

Arguments

Returns

TRUE or FALSE.

grid_col_id

Retrieves the Grid column ID for the given grid column name.

Arguments

Returns

The field ID found, or FALSE if no valid ID is found.

sql

Returns a SQL where-clause based on given table column name and parameter value, using the Field Search syntax rules.

Arguments

Returns

A SQL where-clause, eg. ((field_id_5 = 'foo') OR (field_id_5 = 'bar'))

pro_search_settings

The library class is located in /pro_search/libraries/pro_search_settings.php. Use ee()->pro_search_settings->_method_name_() in your filter class.

get

Gets all settings, or a single one.

Arguments

Returns

All settings if no key is given, the setting value if present, or the fallback if not present.

Pro Search Helper

The helper file is located in /pro_search/helpers/pro_search_helper.php. Use _function_name_() in your filter class.

low_array_is_numeric

Checks if given array only consists of numeric values.

Arguments

Returns

Bool

low_flatten_results

See: array_column. Also works for PHP < 5.5.