Since: 4.0.0

class KeepaliveAssetItem extends WebAssetItem implements WebAssetAttachBehaviorInterface

Web Asset Item class for Keepalive asset

Properties

protected string Since: 4.0.0
$name

Asset name

from  WebAssetItem
protected string Since: 4.0.0
$uri

The URI for the asset

from  WebAssetItem
protected array Since: 4.0.0
$options

Additional options for the asset

from  WebAssetItem
protected array Since: 4.0.0
$attributes

Attributes for the asset, to be rendered in the asset's HTML tag

from  WebAssetItem
protected string[] Since: 4.0.0
$dependencies

Asset dependencies

from  WebAssetItem
protected string Since: 4.0.0
$version

Asset version

from  WebAssetItem

Methods

__construct(string $name, string|null $uri = null, array $options = [], array $attributes = [], array $dependencies = [])

Class constructor

string
getName()

Return Asset name

string
getVersion()

Return Asset version

array
getDependencies()

Return dependencies list

string
getUri(bool $resolvePath = true)

Get the file path

mixed
getOption(string $key, string $default = null)

Get the option

setOption(string $key, string $value = null)

Set the option

array
getOptions()

Get all options

mixed
getAttribute(string $key, string $default = null)

Get the attribute

setAttribute(string $key, string $value = null)

Set the attribute

array
getAttributes()

Get all attributes

string
resolvePath(string $path, string $type)

Resolve path

bool
isPathExternal(string $path)

Check if the Path is External

bool
isPathAbsolute(string $path)

Check if the Path is relative to /media folder or absolute

void
onAttachCallback(Document $doc)

Method called when asset attached to the Document.

Details

__construct(string $name, string|null $uri = null, array $options = [], array $attributes = [], array $dependencies = [])

Since: 4.0.0

Class constructor

Parameters

string $name

The asset name

string|null $uri

The URI for the asset

array $options

Additional options for the asset

array $attributes

Attributes for the asset

array $dependencies

Asset dependencies

string getName()

Since: 4.0.0

Return Asset name

Return Value

string

string getVersion()

Since: 4.0.0

Return Asset version

Return Value

string

array getDependencies()

Since: 4.0.0

Return dependencies list

Return Value

array

string getUri(bool $resolvePath = true)

Since: 4.0.0

Get the file path

Parameters

bool $resolvePath

Whether need to search for a real paths

Return Value

string

mixed getOption(string $key, string $default = null)

Since: 4.0.0

Get the option

Parameters

string $key

An option key

string $default

A default value

Return Value

mixed

WebAssetItemInterface setOption(string $key, string $value = null)

Since: 4.0.0

Set the option

Parameters

string $key

An option key

string $value

An option value

Return Value

WebAssetItemInterface

array getOptions()

Since: 4.0.0

Get all options

Return Value

array

mixed getAttribute(string $key, string $default = null)

Since: 4.0.0

Get the attribute

Parameters

string $key

An attributes key

string $default

A default value

Return Value

mixed

WebAssetItemInterface setAttribute(string $key, string $value = null)

Since: 4.0.0

Set the attribute

Parameters

string $key

An attribute key

string $value

An attribute value

Return Value

WebAssetItemInterface

array getAttributes()

Since: 4.0.0

Get all attributes

Return Value

array

protected string resolvePath(string $path, string $type)

Since: 4.0.0

Resolve path

Parameters

string $path

The path to resolve

string $type

The resolver method

Return Value

string

protected bool isPathExternal(string $path)

Since: 4.0.0

Check if the Path is External

Parameters

string $path

Path to test

Return Value

bool

protected bool isPathAbsolute(string $path)

Since: 4.0.0

Check if the Path is relative to /media folder or absolute

Parameters

string $path

Path to test

Return Value

bool

void onAttachCallback(Document $doc)

Since: 4.0.0

Method called when asset attached to the Document.

Useful for Asset to add a Script options.

Parameters

Document $doc

Active document

Return Value

void