PHP 클래스 Themosis\Asset\Asset

파일 보기 프로젝트 열기: themosis/framework 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$action Themosis\Hook\ActionBuilder
$allowedAreas array Allowed areas.
$area string The default area where to load assets.
$args array WordPress properties of an asset.
$filter Themosis\Hook\FilterBuilder
$html Themosis\Html\HtmlBuilder
$instances array A list of all Asset instances.
$instantiated array A list of enqueued assets.
$key string Asset key name.
$type string Type of the asset.

공개 메소드들

메소드 설명
__construct ( string $type, array $args, Themosis\Hook\IHook $action, HtmlBuilder $html, Themosis\Hook\IHook $filter ) Build an Asset instance.
addAttributes ( array $atts ) : Asset Add attributes to the asset opening tag.
getArea ( ) : string Return the asset area.
getArgs ( string $name = '' ) : array | string Return the asset properties. If $name isset, return its value.
getKey ( ) : string Return the asset key.
getType ( ) : string Return the asset type.
inline ( string $data, string $position = 'after' ) : Asset Add inline code before or after the loaded asset.
install ( ) Install the appropriate asset depending of its area.
isQueued ( ) : boolean Tells if an asset is queued or not.
localize ( string $objectName, mixed $data ) : Asset Localize data for the linked asset.
remove ( ) : Asset Remove a declared asset.
to ( string $area ) : Asset Allow the developer to define where to load the asset.

보호된 메소드들

메소드 설명
orderInstances ( ) Manipulate the static::$instances variable in order to separate each asset in its area.
parse ( array $args ) : mixed Parse defined asset properties.
parseMixed ( $mixed ) : string | boolean Parse the mixed argument.
parseVersion ( string | boolean | null $version ) : mixed Parse the version number.
register ( Asset $asset ) Register the asset.
registerInline ( Asset $asset ) Register inline code.
registerInstance ( ) Register asset instances.
registerScript ( Asset $asset ) Register a 'script' asset.
registerStyle ( Asset $asset ) Register a 'style' asset.

메소드 상세

__construct() 공개 메소드

Build an Asset instance.
public __construct ( string $type, array $args, Themosis\Hook\IHook $action, HtmlBuilder $html, Themosis\Hook\IHook $filter )
$type string
$args array
$action Themosis\Hook\IHook
$html Themosis\Html\HtmlBuilder
$filter Themosis\Hook\IHook

addAttributes() 공개 메소드

Add attributes to the asset opening tag.
public addAttributes ( array $atts ) : Asset
$atts array The asset attributes to add.
리턴 Asset

getArea() 공개 메소드

Return the asset area.
public getArea ( ) : string
리턴 string

getArgs() 공개 메소드

If nothing is defined, return all properties.
public getArgs ( string $name = '' ) : array | string
$name string The argument name.
리턴 array | string

getKey() 공개 메소드

Return the asset key.
public getKey ( ) : string
리턴 string

getType() 공개 메소드

Return the asset type.
public getType ( ) : string
리턴 string

inline() 공개 메소드

Default to "after".
public inline ( string $data, string $position = 'after' ) : Asset
$data string The inline code to output.
$position string Accepts "after" or "before" as values. Note that position is only working for JS assets.
리턴 Asset

install() 공개 메소드

Install the appropriate asset depending of its area.
public install ( )

isQueued() 공개 메소드

Tells if an asset is queued or not.
public isQueued ( ) : boolean
리턴 boolean

localize() 공개 메소드

Output JS object right before the script output.
public localize ( string $objectName, mixed $data ) : Asset
$objectName string The name of the JS variable that will hold the data.
$data mixed Any data to attach to the JS variable: string, boolean, object, array, ...
리턴 Asset

orderInstances() 보호된 메소드

Manipulate the static::$instances variable in order to separate each asset in its area.
protected orderInstances ( )

parse() 보호된 메소드

Parse defined asset properties.
protected parse ( array $args ) : mixed
$args array The asset properties.
리턴 mixed

parseMixed() 보호된 메소드

Parse the mixed argument.
protected parseMixed ( $mixed ) : string | boolean
$mixed
리턴 string | boolean

parseVersion() 보호된 메소드

Parse the version number.
protected parseVersion ( string | boolean | null $version ) : mixed
$version string | boolean | null
리턴 mixed

register() 보호된 메소드

Register the asset.
protected register ( Asset $asset )
$asset Asset

registerInline() 보호된 메소드

Register inline code.
protected registerInline ( Asset $asset )
$asset Asset

registerInstance() 보호된 메소드

Register asset instances.
protected registerInstance ( )

registerScript() 보호된 메소드

Register a 'script' asset.
protected registerScript ( Asset $asset )
$asset Asset

registerStyle() 보호된 메소드

Register a 'style' asset.
protected registerStyle ( Asset $asset )
$asset Asset

remove() 공개 메소드

Remove a declared asset.
public remove ( ) : Asset
리턴 Asset

to() 공개 메소드

Only 'admin', 'login' and 'customizer' are accepted. If none of those values are used, simply keep the default front-end area.
public to ( string $area ) : Asset
$area string Specify where to load the asset: 'admin', 'login' or 'customizer'.
리턴 Asset

프로퍼티 상세

$action 보호되어 있는 프로퍼티

protected ActionBuilder,Themosis\Hook $action
리턴 Themosis\Hook\ActionBuilder

$allowedAreas 보호되어 있는 프로퍼티

Allowed areas.
protected array $allowedAreas
리턴 array

$area 보호되어 있는 프로퍼티

The default area where to load assets.
protected string $area
리턴 string

$args 보호되어 있는 프로퍼티

WordPress properties of an asset.
protected array $args
리턴 array

$filter 보호되어 있는 프로퍼티

protected FilterBuilder,Themosis\Hook $filter
리턴 Themosis\Hook\FilterBuilder

$html 보호되어 있는 프로퍼티

protected HtmlBuilder,Themosis\Html $html
리턴 Themosis\Html\HtmlBuilder

$instances 보호되어 있는 정적으로 프로퍼티

A list of all Asset instances.
protected static array $instances
리턴 array

$instantiated 보호되어 있는 정적으로 프로퍼티

A list of enqueued assets.
protected static array $instantiated
리턴 array

$key 보호되어 있는 프로퍼티

Asset key name.
protected string $key
리턴 string

$type 보호되어 있는 프로퍼티

Type of the asset.
protected string $type
리턴 string