Horde_View_Json
extends Horde_View_Base
in package
Concrete class for handling views.
Tags
Table of Contents
- $defaultFormBuilder : string
- $_encoding : string
- Encoding to use in escaping mechanisms.
- $_file : string
- Template to execute.
- $_helpers : array<string|int, mixed>
- Cache of helper objects.
- $_protectedProperties : array<string|int, mixed>
- Protected properties.
- $_templatePath : array<string|int, mixed>
- Path stack for templates.
- $_throwOnHelperCollision : bool
- Should we throw an error if helper methods collide?
- __call() : string
- Accesses a helper object from within a template.
- __construct() : mixed
- Constructor.
- __get() : null
- Undefined variables return null.
- addHelper() : Horde_View_Helper
- Adds to the stack of helpers in LIFO order.
- addTemplatePath() : mixed
- Adds to the stack of template paths in LIFO order.
- assign() : mixed
- Assigns multiple variables to the view.
- getEncoding() : string
- Returns the current output encoding.
- getTemplatePaths() : array<string|int, mixed>
- Returns the template paths.
- render() : string
- Processes a template and returns the output.
- renderPartial() : string
- Renders a partial template.
- setEncoding() : mixed
- Sets the output encoding.
- setTemplatePath() : mixed
- Resets the stack of template paths.
- throwOnHelperCollision() : mixed
- Controls the behavior when a helper method is overridden by another helper.
- _run() : mixed
- Satisfy the abstract _run function in Horde_View_Base.
- _template() : string
- Finds a template from the available directories.
Properties
$defaultFormBuilder
public
static string
$defaultFormBuilder
= 'Horde_View_Helper_Form_Builder'
$_encoding
Encoding to use in escaping mechanisms.
private
string
$_encoding
= 'UTF-8'
$_file
Template to execute.
private
string
$_file
= \null
Stored in a private variable to keep it out of the public view scope.
$_helpers
Cache of helper objects.
private
array<string|int, mixed>
$_helpers
= array()
$_protectedProperties
Protected properties.
private
array<string|int, mixed>
$_protectedProperties
$_templatePath
Path stack for templates.
private
array<string|int, mixed>
$_templatePath
= array('./')
$_throwOnHelperCollision
Should we throw an error if helper methods collide?
private
bool
$_throwOnHelperCollision
= \false
Methods
__call()
Accesses a helper object from within a template.
public
__call(string $method, array<string|int, mixed> $args) : string
Parameters
- $method : string
-
The helper method.
- $args : array<string|int, mixed>
-
The parameters for the helper.
Tags
Return values
string —The result of the helper method.
__construct()
Constructor.
public
__construct([array<string|int, mixed> $config = array() ]) : mixed
Parameters
- $config : array<string|int, mixed> = array()
-
Configuration key-value pairs.
Return values
mixed —__get()
Undefined variables return null.
public
__get(mixed $name) : null
Parameters
- $name : mixed
Return values
null —addHelper()
Adds to the stack of helpers in LIFO order.
public
addHelper(Horde_View_Helper|string $helper) : Horde_View_Helper
If the $helper parameter is a string instead of a Helper instance, then it will be treated as a class name. Names without "" and that do not have "Helper" in them will be prefixed with Horde_View_Helper; other names will be treated as literal class names. Examples:
// Adds a new Horde_View_Helper_Tag to the view:
$v->addHelper('Tag');
// Adds a new AppHelper object to the view if it exists, otherwise
// throws an exception:
$v->addHelper('AppHelper');
Parameters
- $helper : Horde_View_Helper|string
-
The helper instance to add.
Tags
Return values
Horde_View_Helper —Returns the helper object that was added.
addTemplatePath()
Adds to the stack of template paths in LIFO order.
public
addTemplatePath(mixed $path) : mixed
Parameters
- $path : mixed
Return values
mixed —assign()
Assigns multiple variables to the view.
public
assign(array<string|int, mixed> $array) : mixed
The array keys are used as names, each assigned their corresponding array value.
Parameters
- $array : array<string|int, mixed>
-
The array of key/value pairs to assign.
Return values
mixed —getEncoding()
Returns the current output encoding.
public
getEncoding() : string
Return values
string —The current character set.
getTemplatePaths()
Returns the template paths.
public
getTemplatePaths() : array<string|int, mixed>
Return values
array<string|int, mixed> —The stack of current template paths.
render()
Processes a template and returns the output.
public
render([string $name = '' ][, mixed $locals = array() ]) : string
Parameters
- $name : string = ''
-
The template to process.
- $locals : mixed = array()
Return values
string —The template output.
renderPartial()
Renders a partial template.
public
renderPartial(string $name[, array<string|int, mixed> $options = array() ]) : string
Partial template filenames are named with a leading underscore, although this underscore is not used when specifying the name of the partial.
We would reference the file /views/shared/_sidebarInfo.html in our template using:
renderPartial('sidebarInfo') ?>
Parameters
- $name : string
- $options : array<string|int, mixed> = array()
Return values
string —The template output.
setEncoding()
Sets the output encoding.
public
setEncoding(string $encoding) : mixed
Parameters
- $encoding : string
-
A character set name.
Return values
mixed —setTemplatePath()
Resets the stack of template paths.
public
setTemplatePath(mixed $path) : mixed
To clear all paths, use Horde_View::setTemplatePath(null).
Parameters
- $path : mixed
Return values
mixed —throwOnHelperCollision()
Controls the behavior when a helper method is overridden by another helper.
public
throwOnHelperCollision([bool $throw = true ]) : mixed
Parameters
- $throw : bool = true
-
Throw an exception when helper methods collide?
Return values
mixed —_run()
Satisfy the abstract _run function in Horde_View_Base.
protected
_run() : mixed
Return values
mixed —_template()
Finds a template from the available directories.
protected
_template( $name) : string
Parameters
Return values
string —The full path to the first matching template.