Property | Type | Description | |
---|---|---|---|
$isAjaxRequest | boolean | Is the current request an AJAX request. | |
$isPrintRequest | boolean | Is the current request a print request. | |
$scriptMapping |
Property | Type | Description | |
---|---|---|---|
$cacheBuster | CacheBuster | CacheBuster component reference. | |
$clientScript | ClientScript | ClientScript component reference. | |
$css | array | Pre-registered css files. | |
$cssPriority | integer | Default starting css priority. | |
$js | array | Pre-registered script files. | |
$jsPriority | integer | Default starting script priority. |
Method | Description | |
---|---|---|
adjustScriptMapping ( ) | Adjust the the client script mapping (for javascript and css files assets). | |
createUrl ( string $path = null, string $basePathAlias = null, $bustCache = true ) : string | Creates an absolute URL to a published asset. Eg: '/path/to/hash/asset.gif?cachebusted'. | |
getClientScript ( ) : ClientScript | ||
getPublishedPath ( string $path = '', null | string $alias = null ) : string | Returns the absolute filesystem path to the published asset. | |
getPublishedPathOfAlias ( string $alias = null ) : string | Returns the published asset path for a given asset directory alias. | |
init ( ) | Initializes the component. | |
registerCoreCssFile ( string $style = '', null | integer $priority = null, OUTPUT_PRINT | OUTPUT_SCREEN | OUTPUT_AJAX | OUTPUT_ALL $output = self::OUTPUT_ALL, boolean $preRegister = true ) | Register a core style. | |
registerCoreScript ( string $script = '' ) | Register a core (framework) script. | |
registerCssFile ( string $style = '', null | string | false $basePathAlias = null, null | integer $priority = null, $output = self::OUTPUT_ALL, boolean $preRegister = true ) | Register an application style. | |
registerFiles ( ) | Register all assets that were preregistered by priority. This method is required to output the assets in the page. | |
registerScriptFile ( string $script = '', [type] $basePathAlias = null, [type] $priority = null, $output = self::OUTPUT_ALL, boolean $preRegister = true ) | Register an application script. | |
reset ( ) | ||
setCacheBuster ( CacheBuster $cacheBuster ) | Set the CacheBuster reference. | |
setClientScript ( ClientScript $clientScript ) | Set the ClientScript reference. |
Method | Description | |
---|---|---|
addOrderedCssFile ( string $path, integer $priority = 200, $output = self::OUTPUT_ALL ) | (Pre)register a CSS file with a priority to allow ordering. | |
addOrderedScriptFile ( string $path, integer $priority = 200, $output = self::OUTPUT_ALL ) | (Pre)register a JS file with a priority to allow ordering. | |
canOutput ( OUTPUT_PRINT | OUTPUT_SCREEN | OUTPUT_AJAX | OUTPUT_ALL $output = null ) : boolean | Determines whether an asset should be output for the current request. | |
registerOrderedCssFiles ( ) | Registers all CSS files that were preregistered by priority. | |
registerOrderedScriptFiles ( ) | Registers all JS files that were preregistered by priority. | |
sort ( array &$arr ) | Sorts an array by priority. |
protected addOrderedCssFile ( string $path, integer $priority = 200, $output = self::OUTPUT_ALL ) | ||
$path | string | |
$priority | integer |
protected addOrderedScriptFile ( string $path, integer $priority = 200, $output = self::OUTPUT_ALL ) | ||
$path | string | |
$priority | integer |
public adjustScriptMapping ( ) |
public createUrl ( string $path = null, string $basePathAlias = null, $bustCache = true ) : string | ||
$path | string | The path to the asset. Eg: 'img/cat.gif' |
$basePathAlias | string | The alias path to the base location of the asset. Eg: 'application.modules.mymodule.assets' |
return | string | The absolute path to the published asset. |
public getPublishedPathOfAlias ( string $alias = null ) : string | ||
$alias | string | The alias to the assets. |
return | string | The publish assets path. |
public registerCoreCssFile ( string $style = '', null | integer $priority = null, OUTPUT_PRINT | OUTPUT_SCREEN | OUTPUT_AJAX | OUTPUT_ALL $output = self::OUTPUT_ALL, boolean $preRegister = true ) | ||
$style | string | The core style string to be registered. Eg: 'dir/file.css' |
$priority | null | integer | The priority for the asset. Higher priority styles will be outputted in the page first. |
$output | OUTPUT_PRINT | OUTPUT_SCREEN | OUTPUT_AJAX | OUTPUT_ALL | The output type. |
$preRegister | boolean | Pre-register the asset (if set to false, priority will be ignored) |
public registerCoreScript ( string $script = '' ) | ||
$script | string | The core script to be registered. Eg: 'jquery' |
public registerCssFile ( string $style = '', null | string | false $basePathAlias = null, null | integer $priority = null, $output = self::OUTPUT_ALL, boolean $preRegister = true ) | ||
$style | string | The style path. Eg: 'css/style.css' |
$basePathAlias | null | string | false | The alias for the basepath. Eg: 'application.modules.mymodule.assets' |
$priority | null | integer | The priority for the asset. Higher priority styles will be outputted in the page first. |
$preRegister | boolean | Pre-register the asset (if set to false, priority and output will be ignored) |
public registerFiles ( ) |
protected registerOrderedCssFiles ( ) |
protected registerOrderedScriptFiles ( ) |
public registerScriptFile ( string $script = '', [type] $basePathAlias = null, [type] $priority = null, $output = self::OUTPUT_ALL, boolean $preRegister = true ) | ||
$script | string | The script path. Eg: 'js/script.js' |
$basePathAlias | [type] | |
$priority | [type] | |
$preRegister | boolean | Pre-register the asset (if set to false, priority and output will be ignored) |
public setCacheBuster ( CacheBuster $cacheBuster ) | ||
$cacheBuster | CacheBuster | The CacheBuster instance. |
public setClientScript ( ClientScript $clientScript ) | ||
$clientScript | ClientScript | The ClientScript instance. |
protected CacheBuster $cacheBuster | ||
return | CacheBuster |
protected ClientScript $clientScript | ||
return | ClientScript |
protected int $cssPriority | ||
return | integer |
public bool $isAjaxRequest | ||
return | boolean |
public bool $isPrintRequest | ||
return | boolean |
protected int $jsPriority | ||
return | integer |