__construct()
createTemplateObject()
getDependencyHandler()
getNeedsContainer()
preloadTemplate()
renderContainer()
renderError()
renderMessage()
renderRedirect()
renderSubView()
renderUnrepresentable()
renderView()
renderViewObject()
replaceRequiredExternalPlaceholders()
setNeedsContainer()
_preloadContainerData()
$_dependencies
$_needsContainer
$_request
$_response
Abstract handler for view rendering of a particular response type.
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)
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.
string
Name of the template to create
array
Key-value parameters to pass to the template
getDependencyHandler() : \XenForo_Dependencies_Abstract
getNeedsContainer() : boolean
boolean
preloadTemplate(string $templateName)
string
Template 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.
string
Contents from a previous render method
array
Key-value pairs to manipulate the container
string
Rendered outputrenderError(string $errorText) : string | false
string
Text of the error to render
string
false
Rendered output. False if rendering wasn't possible (see {@link renderUnrepresentable()}).renderMessage(string $message) : string | false
string
Text of the message to render
string
false
Rendered 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.
integer
Type of redirect. See {@link XenForo_ControllerResponse_Redirect}
string
Target to redirect to
mixed
Redirect message (unused by some redirect methods)
array
Extra redirect parameters (unused by HTML)
string
Empty string (nothing to display)renderSubView(\XenForo_ControllerResponse_View $subView) : string | \XenForo_Template_Abstract | false
renderUnrepresentable() : string
Method is called when the concrete rendering function returns false or no concrete rendering function is available.
string
Rendered outputrenderView(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.
string
Name of the view to create
array
Key-value array of parameters for the view.
string
Name of the template that will be used to display (may be ignored by view)
string
\XenForo_Template_Abstract
false
Rendered 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).
string
View class name
string
Response type (translated to method name as render$type)
array
Key-value parameters to pass to view. May be modified by the prepareParams call within.
string
Template name to pass to view (may be ignored by view)
string
false
null
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.
string
Already rendered output
string
setNeedsContainer(boolean $required) : boolean
boolean
boolean
_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.
$_needsContainer : boolean
This may apply to an entire renderer or just individual render types.
$_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.
$_response : \Zend_Controller_Response_Http
Generally should only be used to manipulate response codes if needed.