Asset
abstract class Asset implements AssetInterface (View source)
Properties
protected string | $assetHandle | The handle of this asset (together with getAssetType, identifies this asset). |
|
protected string | $position | The position of this asset (\Concrete\Core\Asset\AssetInterface::ASSET_POSITION_HEADER or \Concrete\Core\Asset\AssetInterface::ASSET_POSITION_FOOTER). |
|
protected bool | $local | Is this asset a locally available file (accessible with the getAssetPath method)? |
|
protected bool | $assetSupportsMinification | Does this asset support minification? |
|
protected bool | $assetSupportsCombination | Can this asset be combined with other assets? |
|
protected string | $location | The location of the asset (used to build the path & URL). |
|
protected string | $assetURL | The URL of this asset. |
|
protected string | $assetPath | The path to this asset. |
|
protected bool | $assetHasBeenMapped | Does the URL/path have already been resolved (starting from the location) for this (local) assets? |
|
protected string | $filename | The name of the file of this asset. |
|
protected string | $assetVersion | The asset version. |
|
protected Package|Package|null | $pkg | The package that defines this asset. |
|
protected array | $combinedAssetSourceFiles | The URL of the source files this asset has been built from (useful to understand the origin of this asset). |
Methods
Initialize the instance.
Set the position of this asset (\Concrete\Core\Asset\AssetInterface::ASSET_POSITION_HEADER or \Concrete\Core\Asset\AssetInterface::ASSET_POSITION_FOOTER).
Get the position of this asset (\Concrete\Core\Asset\AssetInterface::ASSET_POSITION_HEADER or \Concrete\Core\Asset\AssetInterface::ASSET_POSITION_FOOTER).
Get the handle of this asset (together with getAssetType, identifies this asset).
Get the resulting type of the asset (\Concrete\Core\Asset\AssetInterface::OUTPUTASSETTYPE_CSS, \Concrete\Core\Asset\AssetInterface::OUTPUTASSETTYPE_JAVASCRIPT or other values).
Is this asset a locally available file (accessible with the getAssetPath method)?
Is this asset a locally available file (accessible with the getAssetPath method)?
Does this asset support minification?
Does this asset support minification?
Can this asset be combined with other assets?
Can this asset be combined with other assets?
Set the location of this asset.
Set the URL of this asset.
Get the URL of this asset.
Set the path to this asset.
Get the path to this asset.
If the asset is local, set its path and URL starting from the relative path. If it's not local, set its URL.
Does the URL/path have already been resolved (starting from the location) for this (local) assets?
Get the path of the parent "folder" that contains this asset.
Get the name of the file of this asset.
Get a string that unambiguously identifies this asset.
Set the version of this asset.
Get the version of this asset.
Get the contents of the asset (if applicable).
Set the URL of the source files this asset has been built from (useful to understand the origin of this asset).
Get an AssetPointer instance that identifies this asset.
Get the contents of an asset given its route.
Details
__construct(string $assetHandle = '')
Initialize the instance.
setAssetPosition(string $position)
Set the position of this asset (\Concrete\Core\Asset\AssetInterface::ASSET_POSITION_HEADER or \Concrete\Core\Asset\AssetInterface::ASSET_POSITION_FOOTER).
string
getAssetPosition()
Get the position of this asset (\Concrete\Core\Asset\AssetInterface::ASSET_POSITION_HEADER or \Concrete\Core\Asset\AssetInterface::ASSET_POSITION_FOOTER).
string
getAssetHandle()
Get the handle of this asset (together with getAssetType, identifies this asset).
string
getOutputAssetType()
Get the resulting type of the asset (\Concrete\Core\Asset\AssetInterface::OUTPUTASSETTYPE_CSS, \Concrete\Core\Asset\AssetInterface::OUTPUTASSETTYPE_JAVASCRIPT or other values).
setAssetIsLocal(bool $isLocal)
Is this asset a locally available file (accessible with the getAssetPath method)?
bool
isAssetLocal()
Is this asset a locally available file (accessible with the getAssetPath method)?
setAssetSupportsMinification(bool $minify)
Does this asset support minification?
bool
assetSupportsMinification()
Does this asset support minification?
setAssetSupportsCombination(bool $combine)
Can this asset be combined with other assets?
bool
assetSupportsCombination()
Can this asset be combined with other assets?
setAssetLocation(string $location)
Set the location of this asset.
setAssetURL(string $url)
Set the URL of this asset.
string
getAssetURL()
Get the URL of this asset.
setAssetPath(string $path)
Set the path to this asset.
string
getAssetPath()
Get the path to this asset.
mapAssetLocation(string $path)
If the asset is local, set its path and URL starting from the relative path. If it's not local, set its URL.
bool
hasAssetBeenMapped()
Does the URL/path have already been resolved (starting from the location) for this (local) assets?
string
getAssetURLPath()
Get the path of the parent "folder" that contains this asset.
string
getAssetFilename()
Get the name of the file of this asset.
string
getAssetHashKey()
Get a string that unambiguously identifies this asset.
setAssetVersion(string $version)
Set the version of this asset.
string
getAssetVersion()
Get the version of this asset.
string|null
getAssetContents()
Get the contents of the asset (if applicable).
setCombinedAssetSourceFiles(string[] $paths)
Set the URL of the source files this asset has been built from (useful to understand the origin of this asset).
register(string $filename, array $args, Package|Package|string|null|false $pkg = false)
Register the asset properties.
static AssetInterface[]
process(AssetInterface[] $assets)
Asset-type specific post-processing.
AssetPointer
getAssetPointer()
Get an AssetPointer instance that identifies this asset.
static protected string|null
getAssetContentsByRoute(string $route)
Get the contents of an asset given its route.