Overview
  • Namespace
  • Class

Namespaces

  • yii2cdn

Classes

  • Cdn
  • Component
  • ConfigFile
  • ConfigLoader
  • ConfigParser
  • File
  • Section

Class File

Yii2 Section File Component

Namespace: yii2cdn
Package: yii2cdn
Author: Junaid Atari mj.atari@gmail.com
Version: 0.1
Located at src/File.php

Methods summary

public
# __construct( array $config )

ComponentFile constructor.

ComponentFile constructor.

Parameters

$config
Configuration object
public string
# getUrl( )

Get current file url

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

yii2cdn\Section|string
Section object | Section name
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

yii2cdn\Component|string
Component object | Component id
public array
# getAttributes( )

Get the file attributes

Get the file attributes

Returns

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

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

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.

Properties summary

protected string $fileId

File ID

File ID

#
protected string $fileUrl

File Url

File Url

#
protected string $section

Section name

Section name

#
protected string $component

Component name

Component name

#
protected array $options

File options

File options

# []
protected array $attributes

File attributes

File attributes

# []
API documentation generated by ApiGen