public function onBeforeQueryCustomFields(mixed &$query, mixed $options) : void

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

&$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).

Return Value

None.


Example

/**
 * Trigger hook to allow the plugins to manipulate the query used to retrieve
 * the available custom fields.
 *
 * @param   mixed  &$query   The query string or a query builder object.
 * @param   array  $options  An array of query options.
 *
 * @return  void
 */
public function onBeforeQueryCustomFields(&$query, $options)
{
    /**
     * @todo it is possible to manipulate here the query
     */
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-08 12:33
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information