English (United Kingdom)

apply_filters_ref_array( 'vikappointments_build_services_list_data', bool $status, array &$groupsJModelVAP $model )

Fires before returning the array of services.


Description

Trigger hook to manipulate at runtime the response of the query used to load the services to display, under the Services List page.

Third party plugins can alter the resulting list of services (and groups).


Parameters

$status

(bool)  True on success, false otherwise.

&$groups

(array)  An array of groups, which contain an array of services each.

$model

(JModelVAP)  The model responsible of loading the data needed to the Services List page.


Example

The example below uses a default title for those items that do not belong to a group.

/**
 * Trigger hook to manipulate the query response at runtime. Third party
 * plugins can alter the resulting list of services (and groups).
 *
 * @param  boolean    $status   True on success, false otherwise.
 * @param  array      &$groups  An array of groups and services.
 * @param  JModelVAP  $model    The view model.
 */
add_filter('vikappointments_build_services_list_data', function($status, &$groups, $model)
{
    // make sure the slot holding the services w/o a group exists
    if (isset($groups[0]))
    {
        // use a default title
        $groups[0]->name = __('Uncategorized', 'my-plugin');
    }

    return true;
}, 10, 3);

Changelog

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