PHP 클래스 Webiny\Component\TemplateEngine\Plugin

This class is used by template engines to register plugins. Based on the template engine a plugin can be a modifier, a tag, a filter or something else.
상속: use trait Webiny\Component\StdLib\StdLibTrait
파일 보기 프로젝트 열기: Webiny/Framework 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $name, string $type, Closure | string $callbackFunction, array $params = [] ) Base constructor.
getAttribute ( string $key, mixed $defaultValue = false ) : mixed Return the attribute value under the defined $key.
getCallbackFunction ( ) : callable | string Get the callable function.
getName ( ) : string Get plugin name.
getParams ( ) : array Get plugin parameters.
getType ( ) : string Get plugin type.
setAttribute ( string $key, mixed $value ) Sets an optional attribute to the plugin.

메소드 상세

__construct() 공개 메소드

Base constructor.
public __construct ( string $name, string $type, Closure | string $callbackFunction, array $params = [] )
$name string Plugin Name of the plugin.
$type string Plugin type. The type value depends on the current template engine driver. They usually have values like "function", "tag", "modifier"..etc. Basically they define the type of the plugin.
$callbackFunction Closure | string Callback function that holds the plugin logic.
$params array Optional parameters that can be passed to the plugin.

getAttribute() 공개 메소드

Return the attribute value under the defined $key.
public getAttribute ( string $key, mixed $defaultValue = false ) : mixed
$key string Attribute key.
$defaultValue mixed Default value that the method should return if $key is not found among the attributes.
리턴 mixed

getCallbackFunction() 공개 메소드

Get the callable function.
public getCallbackFunction ( ) : callable | string
리턴 callable | string Plugin callable function.

getName() 공개 메소드

Get plugin name.
public getName ( ) : string
리턴 string Plugin name.

getParams() 공개 메소드

Get plugin parameters.
public getParams ( ) : array
리턴 array Plugin params.

getType() 공개 메소드

Get plugin type.
public getType ( ) : string
리턴 string Plugin type.

setAttribute() 공개 메소드

Sets an optional attribute to the plugin.
public setAttribute ( string $key, mixed $value )
$key string Attribute key.
$value mixed Attribute value.