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

__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.

setPackageObject(Package|Package|null|false $pkg)

Set the package that defines 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.

getAssetPointer()

Get an AssetPointer instance that identifies this asset.

static string|null
getAssetContentsByRoute(string $route)

Get the contents of an asset given its route.

string
obfuscateNoCacheValue(string $noCacheValue)

Obfuscate the value of the query-string parameter used to avoid browser cache problems.

Details

__construct(string $assetHandle = '')

Initialize the instance.

Parameters

string $assetHandle

the handle of this asset (together with getAssetType, identifies this asset)

setAssetPosition(string $position)

Set the position of this asset (\Concrete\Core\Asset\AssetInterface::ASSET_POSITION_HEADER or \Concrete\Core\Asset\AssetInterface::ASSET_POSITION_FOOTER).

Parameters

string $position

See also

AssetInterface::setAssetPosition

string getAssetPosition()

Get the position of this asset (\Concrete\Core\Asset\AssetInterface::ASSET_POSITION_HEADER or \Concrete\Core\Asset\AssetInterface::ASSET_POSITION_FOOTER).

Return Value

string

See also

AssetInterface::getAssetPosition

string getAssetHandle()

Get the handle of this asset (together with getAssetType, identifies this asset).

Return Value

string

See also

AssetInterface::getAssetHandle

string getOutputAssetType()

Get the resulting type of the asset (\Concrete\Core\Asset\AssetInterface::OUTPUTASSETTYPE_CSS, \Concrete\Core\Asset\AssetInterface::OUTPUTASSETTYPE_JAVASCRIPT or other values).

Return Value

string

See also

AssetInterface::getOutputAssetType

setAssetIsLocal(bool $isLocal)

Is this asset a locally available file (accessible with the getAssetPath method)?

Parameters

bool $isLocal

See also

AssetInterface::setAssetIsLocal

bool isAssetLocal()

Is this asset a locally available file (accessible with the getAssetPath method)?

Return Value

bool

See also

AssetInterface::isAssetLocal

setAssetSupportsMinification(bool $minify)

Does this asset support minification?

Parameters

bool $minify

See also

AssetInterface::setAssetSupportsMinification

bool assetSupportsMinification()

Does this asset support minification?

Return Value

bool

See also

AssetInterface::assetSupportsMinification

setAssetSupportsCombination(bool $combine)

Can this asset be combined with other assets?

Parameters

bool $combine

See also

AssetInterface::setAssetSupportsCombination

bool assetSupportsCombination()

Can this asset be combined with other assets?

Return Value

bool

See also

AssetInterface::assetSupportsCombination

setAssetLocation(string $location)

Set the location of this asset.

Parameters

string $location

setAssetURL(string $url)

Set the URL of this asset.

Parameters

string $url

See also

AssetInterface::setAssetURL

string getAssetURL()

Get the URL of this asset.

Return Value

string

See also

AssetInterface::getAssetURL

setAssetPath(string $path)

Set the path to this asset.

Parameters

string $path

See also

AssetInterface::setAssetPath

string getAssetPath()

Get the path to this asset.

Return Value

string

See also

AssetInterface::getAssetPath

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.

Parameters

string $path

See also

AssetInterface::mapAssetLocation

bool hasAssetBeenMapped()

Does the URL/path have already been resolved (starting from the location) for this (local) assets?

Return Value

bool

string getAssetURLPath()

Get the path of the parent "folder" that contains this asset.

Return Value

string

See also

AssetInterface::getAssetURLPath

string getAssetFilename()

Get the name of the file of this asset.

Return Value

string

See also

AssetInterface::getAssetFilename

string getAssetHashKey()

Get a string that unambiguously identifies this asset.

Return Value

string

See also

AssetInterface::getAssetHashKey

setAssetVersion(string $version)

Set the version of this asset.

Parameters

string $version

See also

AssetInterface::setAssetVersion

string getAssetVersion()

Get the version of this asset.

Return Value

string

See also

AssetInterface::getAssetVersion

setPackageObject(Package|Package|null|false $pkg)

Set the package that defines this asset.

Parameters

Package|Package|null|false $pkg

See also

AssetInterface::setPackageObject

string|null getAssetContents()

Get the contents of the asset (if applicable).

Return Value

string|null

See also

AssetInterface::getAssetContents

setCombinedAssetSourceFiles(string[] $paths)

Set the URL of the source files this asset has been built from (useful to understand the origin of this asset).

Parameters

string[] $paths

See also

AssetInterface::setCombinedAssetSourceFiles

register(string $filename, array $args, Package|Package|string|null|false $pkg = false)

Register the asset properties.

Parameters

string $filename

the location of the asset

array $args

{

@var bool $local is this asset a locally available file (accessible with the getAssetPath method)?
@var bool $minify does this asset support minification?
@var bool $combine can this asset be combined with other assets?
@var string $version the version of this asset
@var string $position the position of this asset (\Concrete\Core\Asset\AssetInterface::ASSET_POSITION_HEADER or \Concrete\Core\Asset\AssetInterface::ASSET_POSITION_FOOTER).

}

Package|Package|string|null|false $pkg

the package that defines this asset (or its handle)

See also

AssetInterface::register

static AssetInterface[] process(AssetInterface[] $assets)

Asset-type specific post-processing.

Parameters

AssetInterface[] $assets

The original assets

Return Value

AssetInterface[]

The final assets

See also

AssetInterface::process

AssetPointer getAssetPointer()

Get an AssetPointer instance that identifies this asset.

Return Value

AssetPointer

static protected string|null getAssetContentsByRoute(string $route)

Get the contents of an asset given its route.

Parameters

string $route

Return Value

string|null

protected string obfuscateNoCacheValue(string $noCacheValue)

Obfuscate the value of the query-string parameter used to avoid browser cache problems.

Parameters

string $noCacheValue

Return Value

string