PHP Класс Airship\Engine\Lens

For MVC developers, this is analogous to a View
Наследование: use trait Airship\Engine\Bolt\Log
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( Twig_Environment $twigEnv ) Lens constructor.
addGlobal ( string $key, &mixed $value ) : self Add a global variable to Twig
append ( string $key, mixed $val ) : self Maintain an array of values for later rendering, appending the supplied value.
display ( string $base, array $params = [], string $mime = 'text/html;charset=UTF-8' ) : boolean Render a template and print out its contents.
filter ( string $name, callable $func = null ) : self Add a filter to Twig
func ( string $name, callable $func = null, array $is_safe = ['html'] ) : self Add a function to our Twig environment
listFilters ( ) : array Get all filters
loadMotifCargo ( string $name ) : self Load the cargo for these motifs
loadMotifConfig ( string $name ) : self Load the config for this motif
prepend ( string $key, mixed $val ) : self Maintain an array of values for later rendering, prepending the supplied value.
registerGlobal ( string $name, &array &$value ) : self Register an array or object as a Twig global.
render ( string $base, array $params = [] ) : string Render a template and return its contents as a string.
resetBaseTemplate ( ) : self Reset the base template
sendStandardHeaders ( string $mimeType ) : void Send HTTP headers
setActiveMotif ( string $name ) : boolean Set the active motif
setBaseTemplate ( string $name ) : self Override the base template
store ( string $key, mixed $val ) : self Persist state for later rendering.
unsafeDisplay ( string $file, array $params = [], string $mime = 'text/html;charset=UTF-8' ) : boolean Render a template and print out its contents without sanity checks.
unsafeRender ( string $file, array $params = [] ) : string Render a template and print out its contents without sanity checks.

Описание методов

__construct() публичный метод

Lens constructor.
public __construct ( Twig_Environment $twigEnv )
$twigEnv Twig_Environment

addGlobal() публичный метод

Add a global variable to Twig
public addGlobal ( string $key, &mixed $value ) : self
$key string
$value &mixed
Результат self

append() публичный метод

Maintain an array of values for later rendering, appending the supplied value.
public append ( string $key, mixed $val ) : self
$key string Index
$val mixed Value
Результат self

display() публичный метод

Render a template and print out its contents.
public display ( string $base, array $params = [], string $mime = 'text/html;charset=UTF-8' ) : boolean
$base string Template to render (e.g. 'index' or 'dir/index')
$params array Parameters to pass towards the array
$mime string MIME type header to transmit
Результат boolean

filter() публичный метод

Add a filter to Twig
public filter ( string $name, callable $func = null ) : self
$name string - Name to access n Twig
$func callable - function to apply
Результат self

func() публичный метод

Add a function to our Twig environment
public func ( string $name, callable $func = null, array $is_safe = ['html'] ) : self
$name string - Name to access in Twig
$func callable - function definition
$is_safe array
Результат self

listFilters() публичный метод

Get all filters
public listFilters ( ) : array
Результат array

loadMotifCargo() публичный метод

Load the cargo for these motifs
public loadMotifCargo ( string $name ) : self
$name string
Результат self

loadMotifConfig() публичный метод

Load the config for this motif
public loadMotifConfig ( string $name ) : self
$name string
Результат self

prepend() публичный метод

Maintain an array of values for later rendering, prepending the supplied value.
public prepend ( string $key, mixed $val ) : self
$key string Index
$val mixed Value
Результат self

registerGlobal() публичный метод

Register an array or object as a Twig global.
public registerGlobal ( string $name, &array &$value ) : self
$name string Name to access in Twig (by ref)
$value &array
Результат self

render() публичный метод

Render a template and return its contents as a string.
public render ( string $base, array $params = [] ) : string
$base string Template to render (e.g. 'index' or 'dir/index')
$params array Parameters to pass towards the array
Результат string

resetBaseTemplate() публичный метод

Reset the base template
public resetBaseTemplate ( ) : self
Результат self

sendStandardHeaders() публичный метод

Send HTTP headers
public sendStandardHeaders ( string $mimeType ) : void
$mimeType string
Результат void

setActiveMotif() публичный метод

Set the active motif
public setActiveMotif ( string $name ) : boolean
$name string
Результат boolean

setBaseTemplate() публичный метод

Override the base template
public setBaseTemplate ( string $name ) : self
$name string
Результат self

store() публичный метод

Persist state for later rendering.
public store ( string $key, mixed $val ) : self
$key string Index
$val mixed Value
Результат self

unsafeDisplay() публичный метод

Render a template and print out its contents without sanity checks.
public unsafeDisplay ( string $file, array $params = [], string $mime = 'text/html;charset=UTF-8' ) : boolean
$file string Template to render (e.g. 'index' or 'dir/index')
$params array Parameters to pass towards the array
$mime string MIME type
Результат boolean

unsafeRender() публичный метод

Render a template and print out its contents without sanity checks.
public unsafeRender ( string $file, array $params = [] ) : string
$file string Template to render (e.g. 'index' or 'dir/index')
$params array Parameters to pass towards the array
Результат string