English (United Kingdom)

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

Fires before returning the array of packages.


Description

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

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


Parameters

$status

(bool)  True on success, false otherwise.

&$groups

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

$model

(JModelVAP)  The model responsible of loading the data needed to the Packages 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 packages (and groups).
 *
 * @param  boolean    $status   True on success, false otherwise.
 * @param  array      &$groups  An array of groups and packages.
 * @param  JModelVAP  $model    The view model.
 */
add_filter('vikappointments_build_packages_list_data', function($status, &$groups, $model)
{
    // make sure the slot holding the packages 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