/**
* Method to preload the Rules object for the given asset type.
*
* @param integer|string|array $assetTypes The type or name of the asset (e.g. 'com_content.article', 'com_menus.menu.2').
* Also accepts the asset id. An array of asset type or a special
* 'components' string to load all component assets.
* @param boolean $reload Set to true to reload from database.
*
* @return boolean True on success.
*
* @since 1.6
* @note This method will return void in 4.0.
*/
public static function preload($assetTypes = 'components', $reload = false)
{
// If sent an asset id, we first get the asset type for that asset id.
if (is_numeric($assetTypes)) {
$assetTypes = self::getAssetType($assetTypes);
}
// Check for default case:
$isDefault = \is_string($assetTypes) && \in_array($assetTypes, array('components', 'component'));
// Preload the rules for all of the components.
if ($isDefault) {
self::preloadComponents();
return true;
}
// If we get to this point, this is a regular asset type and we'll proceed with the preloading process.
if (!\is_array($assetTypes)) {
$assetTypes = (array) $assetTypes;
}
foreach ($assetTypes as $assetType) {
self::preloadPermissions($assetType, $reload);
}
return true;
}