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

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

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

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

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-11 09:53
Helpful?
See Also: