class CRM_Core_Resources

This class facilitates the loading of resources such as JavaScript files and CSS files.

Any URLs generated for resources may include a 'cache-code'. By resetting the cache-code, one may force clients to re-download resource files (regardless of any HTTP caching rules).

TODO: This is currently a thin wrapper over CRM_Core_Region. We should incorporte services for aggregation, minimization, etc.





protected array $settings
protected $addedSettings
protected array $settingsFactories
protected array $addedCoreResources
protected array $addedCoreStyles
protected string $cacheCode
protected string $cacheCodeKey
bool $ajaxPopupsEnabled
protected Paths $paths


singleton( $instance = NULL)

Get or set the single instance of CRM_Core_Resources.

__construct(CRM_Extension_Mapper $extMapper, CRM_Utils_Cache_Interface $cache, string|null $cacheCodeKey = NULL)

Construct a resource manager.

addPermissions(array $permNames)

Export permission data to the client to enable smarter GUIs.

addScriptFile(string $ext, string $file, int $weight = self::DEFAULT_WEIGHT, string $region = self::DEFAULT_REGION, bool|string $translate = TRUE)

Add a JavaScript file to the current page using