Concrete renderer for JSON output.
Handles rendering of different types of controller responses.
| package | XenForo_Mvc |
|---|
__construct(\XenForo_Dependencies_Abstract $dependencies, \Zend_Controller_Response_Http $response, \Zend_Controller_Request_Http $request)
| see | \XenForo_ViewRenderer_Abstract::__construct() |
|---|
\XenForo_Dependencies_Abstract
\Zend_Controller_Response_Http
\Zend_Controller_Request_Http
createTemplateObject(string $templateName, array $params) : \XenForo_Template_Abstract
Templates only represent HTML output, so no response type is needed. However, they can be used in any response type.
| inherited_from | \XenForo_ViewRenderer_Abstract::createTemplateObject() |
|---|
stringName of the template to create
arrayKey-value parameters to pass to the template
getDefaultOutputArray(string $viewName, array $params, string $templateName) : array
string
array
string
arraygetDependencyHandler() : \XenForo_Dependencies_Abstract
| inherited_from | \XenForo_ViewRenderer_Abstract::getDependencyHandler() |
|---|
getNeedsContainer() : boolean
| inherited_from | \XenForo_ViewRenderer_Abstract::getNeedsContainer() |
|---|
booleanjsonEncodeForOutput(mixed $input, $addDefaultParams) : string
This renders any objects with string representations to strings.
mixedData to JSON encode. Likely an array, but not always.
stringJSON encoded outputpreloadTemplate(string $templateName)
| inherited_from | \XenForo_ViewRenderer_Abstract::preloadTemplate() |
|---|
stringTemplate name
renderContainer(string $contents, array $params) : string
This often represents the "chrome" of a page, including aspects like the header and footer. The content from the other render methods will generally be put inside this.
Note that not all response types will have a container. In which case, they should return the inner contents directly.
| see | \XenForo_ViewRenderer_Abstract::renderContainer() |
|---|
string
array
stringrenderError(string | array $error) : string
| see | \XenForo_ViewRenderer_Abstract::renderError() |
|---|
stringarrayError message
stringJSON-encoded arrayrenderMessage(string $message) : string | false
| see | \XenForo_ViewRenderer_Abstract::renderMessage() |
|---|
stringText of the message to render
stringfalseRendered output. False if rendering wasn't possible (see {@link renderUnrepresentable()}).renderRedirect(integer $redirectType, string $redirectTarget, mixed $redirectMessage, array $redirectParams) : string
Most renderers will actually redirect, but some may not.
integerType of redirect. See {@link XenForo_ControllerResponse_Redirect}
stringTarget to redirect to
mixedRedirect message
arrayRedirect parameters
stringJSON-encoded arrayrenderSubView(\XenForo_ControllerResponse_View $subView) : string | \XenForo_Template_Abstract | false
| inherited_from | \XenForo_ViewRenderer_Abstract::renderSubView() |
|---|
\XenForo_ControllerResponse_View
renderUnrepresentable() : string
Method is called when the concrete rendering function returns false or no concrete rendering function is available.
| see | \XenForo_ViewRenderer_Abstract::renderUnrepresentable() |
|---|
stringJSON-encoded arrayrenderView(string $viewName, array $params, string $templateName, \XenForo_ControllerResponse_View $subView) : string | \XenForo_Template_Abstract | false
Should instantiate the view object and render it. Note that depending on response type, this class may have to manipulate the view name or instantiate a different object.
| see | \XenForo_ViewRenderer_Abstract::renderView() |
|---|
stringName of the view to create
arrayKey-value array of parameters for the view.
stringName of the template that will be used to display (may be ignored by view)
string\XenForo_Template_AbstractfalseRendered output. False if rendering wasn't possible (see {@link renderUnrepresentable()}).renderViewObject(string $class, string $responseType, array $params, string $templateName) : string | false | null
Returns null if no class can be loaded or no view method has been defined. Otherwise, the return is defined by the view render method, which should return either a string (rendered content) or false (unrepresentable).
| inherited_from | \XenForo_ViewRenderer_Abstract::renderViewObject() |
|---|
stringView class name
stringResponse type (translated to method name as render$type)
arrayKey-value parameters to pass to view. May be modified by the prepareParams call within.
stringTemplate name to pass to view (may be ignored by view)
stringfalsenull
replaceRequiredExternalPlaceholders(\XenForo_Template_Abstract $template, string $rendered) : string
This approach is needed to ensure that all requirements are properly included, even if they are included after the comment has been rendered.
| inherited_from | \XenForo_ViewRenderer_Abstract::replaceRequiredExternalPlaceholders() |
|---|
stringAlready rendered output
stringsetNeedsContainer(boolean $required) : boolean
| inherited_from | \XenForo_ViewRenderer_Abstract::setNeedsContainer() |
|---|
boolean
boolean_addDefaultParams(array $params) : array
array
array_preloadContainerData()
Templates/phrases may be accidentally (or intentionally) rendered in the view or before the container is set to be rendered. Preloading data here can allow all the data to be fetched at once.
| inherited_from | \XenForo_ViewRenderer_Abstract::_preloadContainerData() |
|---|
_stringifyObjectsInArray(array $array) : array
arrayArray to search
arrayArray with objects stringified$_dependencies : \XenForo_Dependencies_Abstract
| inherited_from | \XenForo_ViewRenderer_Abstract::$$_dependencies |
|---|
$_needsContainer : boolean
This may apply to an entire renderer or just individual render types.
| inherited_from | \XenForo_ViewRenderer_Abstract::$$_needsContainer |
|---|
$_request : \Zend_Controller_Request_Http
Can be used to manipulate output based in input parameters AT YOUR OWN RISK. Strictly, making use of this breaks MVC principles, so avoid it if you can.
| inherited_from | \XenForo_ViewRenderer_Abstract::$$_request |
|---|
$_response : \Zend_Controller_Response_Http
Generally should only be used to manipulate response codes if needed.
| inherited_from | \XenForo_ViewRenderer_Abstract::$$_response |
|---|