Lists the rendering control options for responses generated by this controller.
'type'key is the content type that will be rendered by default, unless another is explicitly specified (defaults to
'data'key contains an associative array of variables to be sent to the view, including any variables created in
set(), or if an action returns any variables (as an associative array).
- When an action is invoked, it will by default attempt to render a response, set the
falseto prevent this behavior.
- If you manually call
render()within an action, the
'hasRendered'key stores this state, so that responses are not rendered multiple times, either manually or automatically.
'layout'key specifies the name of the layout to be used (defaults to
'default'). Typically, layout files are looked up as
<app-path>/views/layouts/<layout-name>.<type>.php. Based on the default settings, the actual path would be
- Though typically introspected from the action that is executed, the
'template'key can be manually specified. This sets the template to be rendered, and is looked up (by default) as
- To enable automatic content-type negotiation (i.e. determining the content type of the
response based on the value of the
HTTP Accept header), set the
true. Otherwise, the response will only be based on the
typeparameter of the request object (defaulting to
'html'if no type is present in the
Keep in mind that most of these settings may be passed to
Controller::render() as well. To
change how these settings operate (i.e. template paths, default render settings for
individual media types), see the
protected $_render = [ 'type' => null, 'data' => , 'auto' => true, 'layout' => 'default', 'template' => null, 'hasRendered' => false, 'negotiate' => false ];