English (United Kingdom)
Knowledge Base  >  Vik Appointments  >  Hooks  >  Fields  >  Before Query

apply_filters_ref_array( 'vikappointments_before_query_custom_fields', bool $status, mixed &$query, mixed $options )

Fires while building the query used to fetch the available custom fields.


Description

Trigger hook to allow the plugins to manipulate the query used to load a list of custom fields, useful to apply further restrictions or to fetch some columns stored in separated database tables.


Parameters

$status

(bool)  True on success, false on failure.

&$query

(mixed)  Either a query builder object or a string.

$options

(array)  An associative array containing the query filters.

  • group - the group to which the custom fields should belong (0 for customers, 1 for employees);
  • employee - when specified, only the custom fields belonging to the specified employee will be loaded;
  • services - when specified, only the custom fields belonging to the specified services will be loaded;
  • filter - bitwise mask used to filter the custom fields (0 for no filtering, 1 to exclude the required checkboxes, 2 to exclude separators and 4 for exclude the file inputs).

Example

/**
 * Trigger hook to allow the plugins to manipulate the query used to retrieve
 * the available custom fields.
 *
 * @param  boolean  $status   True on success, false on failure.
 * @param  mixed    &$query   The query string or a query builder object.
 * @param  array    $options  An array of query options.
 */
add_filter('vikappointments_before_query_custom_fields', function($status, &$query, $options)
{
    /**
     * @todo it is possible to manipulate here the query
     */

    return $status;
}, 10, 3);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-08-19
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information