lithium\net\http\Media::view PHP Method

view() public static method

Configures a template object instance, based on a media handler configuration.
See also: lithium\net\http\Media::type()
See also: lithium\template\View::render()
See also: lithium\action\Response
public static view ( mixed $handler, mixed $data, object &$response = null, array $options = [] ) : object
$handler mixed Either a string specifying the name of a media type for which a handler is defined, or an array representing a handler configuration. For more on types and type handlers, see the `type()` method.
$data mixed The data to be rendered. Usually an array.
$response object The `Response` object associated with this dispatch cycle. Usually an instance of `lithium\action\Response`.
$options array Any options that will be passed to the `render()` method of the templating object.
return object Returns an instance of a templating object, usually `lithium\template\View`.
    public static function view($handler, $data, &$response = null, array $options = array())
    {
        $params = array('response' => &$response) + compact('handler', 'data', 'options');
        return static::_filter(__FUNCTION__, $params, function ($self, $params) {
            $handler = $params['handler'];
            $response =& $params['response'];
            $handler = is_array($handler) ? $handler : $self::handlers($handler);
            $class = $handler['view'];
            unset($handler['view']);
            $config = $handler + array('response' => &$response);
            return $self::invokeMethod('_instance', array($class, $config));
        });
    }