AssetsTemplatePlugin
Generic plugin for template systems. Provides several convenience methods for linking assets within templates.
Tags
Table of Contents
$assets | Assets | |
---|---|---|
__construct() | Constructor. | mixed |
js() | Returns HTML ready tags for all assets in the requested JS bundle. | string |
css() | Returns HTML ready tags for all assets in the requested CSS bundle. | string |
url() | Returns URL to asset specified by stream. | mixed |
convertAttributes() | Converts an array of attributes into a form readily usable within XML. | string |
makeSelfClosingTag() | Generates a self closing tag. | string |
makeRegularTag() | Generates a tag pair. | string |
Properties
$assets
private
Assets
$assets
Methods
__construct()
Constructor.
public
__construct(
$assets :
Assets
)
: mixed
Parameters
- $assets : Assets
Return values
mixedjs()
Returns HTML ready tags for all assets in the requested JS bundle.
public
js(
[ $bundleName :
string
= 'js/main' ]
[, $attributes :
array
= [] ]
)
: string
Parameters
- $bundleName : string = 'js/main'
Bundle name.
- $attributes : array = []
Attributes generated tags should include.
Return values
stringcss()
Returns HTML ready tags for all assets in the requested CSS bundle.
public
css(
[ $bundleName :
string
= 'css/main' ]
[, $attributes :
array
= [] ]
)
: string
Parameters
- $bundleName : string = 'css/main'
Bundle name.
- $attributes : array = []
Attributes generated tags should include.
Return values
stringurl()
Returns URL to asset specified by stream.
public
url(
$streamPath :
string|string[]
)
: mixed
Parameters
- $streamPath : string|string[]
A valid stream. EG: 'assets://path.to' or ['assets', 'path.to']
Return values
mixedconvertAttributes()
Converts an array of attributes into a form readily usable within XML.
private
convertAttributes(
$attributes :
array
)
: string
Parameters
- $attributes : array
Attributes to convert.
Return values
stringmakeSelfClosingTag()
Generates a self closing tag.
private
makeSelfClosingTag(
$tagName :
string
[, $attributes :
array|null
= null ]
)
: string
Parameters
- $tagName : string
Tag name.
- $attributes : array|null = null
Attributes to add to tag. Optional.
Return values
stringmakeRegularTag()
Generates a tag pair.
private
makeRegularTag(
$tagName :
string
[, $attributes :
array|null
= null ]
[, $content :
string
= '' ]
)
: string
Parameters
- $tagName : string
Tag name.
- $attributes : array|null = null
Attributes to add to tag. Optional.
- $content : string = ''
Content generated tags will wrap around.