Class File
Yii2 Section File Component
Methods summary
public
|
#
__construct( array $config )
ComponentFile constructor.
ComponentFile constructor.
Parameters
- $config
- Configuration object
|
public
string
|
#
getUrl( )
Get current file url
Returns
string
|
public
yii2cdn\Section |string
|
#
getSection( boolean $asId, string $property = 'cdn' )
Get file section or it's id
Get file section or it's id
Parameters
- $asId
- (optional) True will return section name (default: false)
- $property
- (optional) Property name of
cdn defined in @app/config/main.php (default: 'cdn')
Returns
|
public
yii2cdn\Component |string
|
#
getComponent( boolean $asId, string $property = 'cdn' )
Get current file component or it's id
Get current file component or it's id
Parameters
- $asId
- (optional) True will return component id (default: false)
- $property
- (optional) Property name of
cdn defined in @app/config/main.php (default: 'cdn')
Returns
|
public
array
|
|
public
mixed|null
|
#
getAttr( string $name, boolean $throwException = true )
Parameters
- $name
- File attribute name
- $throwException
- (optional) True will throw exception (default: true)
Returns
mixed|null Attribute value | null on empty
Throws
yii\base\UnknownPropertyException
|
public
|
#
registerAsCssFile( array $options = [], string $key = null )
Register as CSS file
Parameters
- $options
the HTML attributes for the link tag. Please refer to [[Html::cssFile()]] for
the supported options. The following options are specially handled and are not treated as HTML attributes:
depends : array, specifies the names of the asset bundles that this CSS file depends on.
- $key
- the key that identifies the CSS script file. If null, it will use
|
public
string
|
#
getId( )
Get current file id
Returns
string
|
public
|
#
registerAsJsFile( array $options = [], string $key = null )
Register as JavaScript file
Register as JavaScript file
Parameters
- $options
the HTML attributes for the script tag. The following options are specially handled
and are not treated as HTML attributes:
depends : array, specifies the names of the asset bundles that this JS file depends on.
position : specifies where the JS script tag should be inserted in a page. The possible values are:
- [[POS_HEAD]]: in the head section
- [[POS_BEGIN]]: at the beginning of the body section
- [[POS_END]]: at the end of the body section. This is the default value.
Please refer to [[Html::jsFile()]] for other supported options.
- $key
the key that identifies the JS script file. If null, it will use
$url as the key. If two JS files are registered with the same key, the latter
will overwrite the former.
|