JSON renderer

package Default

 Methods

Can this renderer render trees of view models?

canRenderTrees() : true

Yes.

inherited_from \Zend\View\Renderer\TreeRendererInterface::canRenderTrees()

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.

inherited_from \Zend\View\Renderer\RendererInterface::getEngine()

Returns

mixed

Returns whether or not the jsonpCallback has been set

hasJsonpCallback() : boolean

Returns

boolean

Should we merge unnamed children?

mergeUnnamedChildren() : boolean

Returns

boolean

Renders values as JSON

render(string|\Zend\View\Model\ModelInterface $nameOrModel, null|array|\ArrayAccess $values = null) : string
todo Determine what use case exists for accepting both $nameOrModel and $values
inherited_from \Zend\View\Renderer\RendererInterface::render()

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\JsonRenderer

Parameters

$callback

string

Returns

\Zend\View\Renderer\JsonRenderer

Set flag indicating whether or not to merge unnamed children

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

Parameters

$mergeUnnamedChildren

boolean

Returns

\Zend\View\Renderer\JsonRenderer

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
inherited_from \Zend\View\Renderer\RendererInterface::setResolver()

Parameters

$resolver

\Zend\View\Resolver\ResolverInterface

Returns

\Zend\View\Renderer\RendererInterface

Inject discovered child model values into parent model

injectChildren(\Zend\View\Model\ModelInterface $model, array $children) 
todo detect collisions and decide whether to append and/or aggregate?

Parameters

$model

\Zend\View\Model\ModelInterface

$children

array

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

recurseModel(\Zend\View\Model\ModelInterface $model, boolean $mergeWithVariables = true) : array

Parameters

$model

\Zend\View\Model\ModelInterface

$mergeWithVariables

boolean

Whether or not to merge children with the variables of the $model

Returns

array

 Properties

 

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

$jsonpCallback : string

Default

null
 

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

$mergeUnnamedChildren : boolean

Default

false
 

$resolver

$resolver : \Zend\View\Resolver\ResolverInterface

Default