public function onBuildServicesListData(array &$groupsJModelVAP $model) : void

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

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

Return Value

None.


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   array      &$groups  An array of groups and services.
 * @param   JModelVAP  $model    The view model.
 *
 * @return  void
 */
public function onBuildServicesListData(&$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';
    }
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-10 10:27
Helpful?
See Also: