CRM_Core_Resources
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.
Constants
DEFAULT_WEIGHT |
|
DEFAULT_REGION |
|
Properties
protected array | $settings | Settings in free-form data tree. | |
protected | $addedSettings | ||
protected callable[] | $settingsFactories | Setting factories. | |
protected array | $addedCoreResources | Added core resources. | |
protected array | $addedCoreStyles | Added core styles. | |
protected string | $cacheCode | A value to append to JS/CSS URLs to coerce cache resets. | |
protected string | $cacheCodeKey | The name of a setting which persistently stores the cacheCode. | |
bool | $ajaxPopupsEnabled | Are ajax popup screens enabled. | |
protected Paths | $paths |
Methods
static CRM_Core_Resources
singleton(CRM_Core_Resources $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