JSON renderer

category Zend
package Zend_View
subpackage Renderer

 Methods

Can this renderer render trees of view models?

canRenderTrees() : true

Yes.

Returns

true

Return the template engine object, if any

getEngine() : mixed

If using a third-party template engine, such as Smarty, patTemplate, phplib, etc, return the template engine object. Useful for calling methods on these objects, such as for setting filters, modifiers, etc.

Returns

mixed

Returns whether or not the jsonpCallback has been set

hasJsonpCallback() : bool

Returns

bool

Should we merge unnamed children?

mergeUnnamedChildren() : bool

Returns

bool

Renders values as JSON

render(string | \Zend\View\Model\ModelInterface $nameOrModel, null | array | \ArrayAccess $values) : string

todo Determine what use case exists for accepting both $nameOrModel and $values

Parameters

$nameOrModel

string\Zend\View\Model\ModelInterface

The script/resource process, or a view model

$values

nullarray\ArrayAccess

Values to use during rendering

Exceptions

\Zend\View\Exception\DomainException

Returns

stringThe script output.

Set the JSONP callback function name

setJsonpCallback(string $callback) : \Zend\View\Renderer\JsonpModel

Parameters

$callback

string

Returns

\Zend\View\Renderer\JsonpModel

Set flag indicating whether or not to merge unnamed children

setMergeUnnamedChildren(bool $mergeUnnamedChildren) : \Zend\View\Renderer\JsonRenderer

Parameters

$mergeUnnamedChildren

bool

Returns

Set the resolver used to map a template name to a resource the renderer may consume.

setResolver(\Zend\View\Resolver\ResolverInterface $resolver) : \Zend\View\Renderer\RendererInterface

todo Determine use case for resolvers when rendering JSON

Parameters

Returns

Retrieve values from a model and recurse its children to build a data structure

recurseModel(\Zend\View\Model\ModelInterface $model) : array

Parameters

Returns

array

 Properties

 

JSONP callback (if set, wraps the return in a function call)

$jsonpCallback : string

 

Whether or not to merge child models with no capture-to value set

$mergeUnnamedChildren : bool

 

$resolver

$resolver : \Zend\View\Resolver\ResolverInterface