PHP 클래스 lithium\template\Helper

Supplies the basic functionality of _render and _options, as well as escaping.
상속: extends lithium\core\Object
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$contentMap array Maps helper method names to content types as defined by the Media class, where key are method names, and values are the content type that the method name outputs a link to.

보호된 프로퍼티들

프로퍼티 타입 설명
$_autoConfig array Auto configuration properties.
$_classes array This property can be overwritten with any class dependencies a helper subclass has.
$_context lithium\template\view\Renderer The Renderer object this Helper is bound to.
$_minimized array List of minimized HTML attributes.
$_strings array Holds string templates which will be merged into the rendering context.

공개 메소드들

메소드 설명
__construct ( array $config = [] ) : void Constructor.
escape ( string $value, mixed $method = null, array $options = [] ) : mixed Escapes values according to the output type of the rendering context. Helpers that output to non-HTML/XML contexts should override this method accordingly.

보호된 메소드들

메소드 설명
_attribute ( string $key, mixed $value, array $options = [] ) : string Convert a key/value pair to a valid HTML attribute.
_attributes ( array | string $params, string $method = null, array $options = [] ) : string Converts a set of parameters to HTML attributes into a string.
_init ( ) : void Imports local string definitions into rendering context.
_options ( array $defaults, array $scope ) : array Takes the defaults and current options, merges them and returns options which have the default keys removed and full set of options as the scope.
_render ( string $method, string $string, array $params, array $options = [] ) : string Render a string template after applying context filters Use examples in the Html::link() method: return $this->_render(__METHOD__, 'link', compact('title', 'url', 'options'), $scope);

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( array $config = [] ) : void
$config array Configuration options.
리턴 void

_attribute() 보호된 메소드

Convert a key/value pair to a valid HTML attribute.
protected _attribute ( string $key, mixed $value, array $options = [] ) : string
$key string The key name of the HTML attribute.
$value mixed The HTML attribute value.
$options array The options used when converting the key/value pair to attributes: - `'escape'` _boolean_: Indicates whether `$key` and `$value` should be HTML-escaped. Defaults to `true`. - `'format'` _string_: The format string. Defaults to `'%s="%s"'`.
리턴 string Returns an HTML attribute/value pair, in the form of `'$key="$value"'`.

_attributes() 보호된 메소드

Converts a set of parameters to HTML attributes into a string.
또한 보기: lithium\template\view\Renderer::__call()
protected _attributes ( array | string $params, string $method = null, array $options = [] ) : string
$params array | string The parameters where key is the attribute name and the value the attribute value. When string will simply prepend with the prepend-string (by default `' '`) unless $params is falsey in which case an empty string is returned. This alternative syntax is used by the method internally.
$method string When used as a context handler, the method the handler was called for I.e. `'wrap'`. Currently not used by the method.
$options array Available options are: - `'escape'` _boolean_: Indicates whether the output should be HTML-escaped. Defaults to `true`. - `'prepend'` _string_: String to prepend to each attribute pair. and the final result. Defaults to `' '`. - `'append'` _string_: String to append to result. Defaults to `''`.
리턴 string Attribute string.

_init() 보호된 메소드

Imports local string definitions into rendering context.
protected _init ( ) : void
리턴 void

_options() 보호된 메소드

Takes the defaults and current options, merges them and returns options which have the default keys removed and full set of options as the scope.
protected _options ( array $defaults, array $scope ) : array
$defaults array
$scope array the complete set of options
리턴 array $scope, $options

_render() 보호된 메소드

Render a string template after applying context filters Use examples in the Html::link() method: return $this->_render(__METHOD__, 'link', compact('title', 'url', 'options'), $scope);
protected _render ( string $method, string $string, array $params, array $options = [] ) : string
$method string name of method that is calling the render (for context filters)
$string string template key (in Helper::_strings) to render
$params array associated array of template inserts {:key} will be replaced by value
$options array Available options: - `'handlers'` _array_: Before inserting `$params` inside the string template, `$this->_context`'s handlers are applied to each value of `$params` according to the key (e.g `$params['url']`, which is processed by the `'url'` handler via `$this->_context->applyHandler()`). The `'handlers'` option allow to set custom mapping beetween `$params`'s key and `$this->_context`'s handlers. e.g. the following handler: `'handlers' => array('url' => 'path')` will make `$params['url']` to be processed by the `'path'` handler instead of the `'url'` one.
리턴 string Rendered HTML

escape() 공개 메소드

Escapes values according to the output type of the rendering context. Helpers that output to non-HTML/XML contexts should override this method accordingly.
public escape ( string $value, mixed $method = null, array $options = [] ) : mixed
$value string
$method mixed
$options array
리턴 mixed

프로퍼티 상세

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

Auto configuration properties.
protected array $_autoConfig
리턴 array

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

This property can be overwritten with any class dependencies a helper subclass has.
protected array $_classes
리턴 array

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

The Renderer object this Helper is bound to.
또한 보기: lithium\template\view\Renderer
protected lithium\template\view\Renderer $_context
리턴 lithium\template\view\Renderer

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

List of minimized HTML attributes.
protected array $_minimized
리턴 array

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

Holds string templates which will be merged into the rendering context.
protected array $_strings
리턴 array

$contentMap 공개적으로 프로퍼티

Maps helper method names to content types as defined by the Media class, where key are method names, and values are the content type that the method name outputs a link to.
public array $contentMap
리턴 array