lithium\net\http\Media::view()

public static method

Configures a template object instance, based on a media handler configuration.

Parameters

  • mixed $handler

    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.

  • mixed $data

    The data to be rendered. Usually an array.

  • object $response

    The Response object associated with this dispatch cycle. Usually an instance of lithium\action\Response.

  • array $options

    Any options that will be passed to the render() method of the templating object.

Returns

object

Returns an instance of a templating object, usually lithium\template\View.

Filter

This method can be filtered.

Source

	public static function view($handler, $data, &$response = null, array $options = []) {
		$params = ['response' => &$response] + compact('handler', 'data', 'options');

		return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
			$handler = $params['handler'];
			$response =& $params['response'];

			$handler = is_array($handler) ? $handler : static::handlers($handler);
			$class = $handler['view'];
			unset($handler['view']);

			$config = $handler + ['response' => &$response];
			return Libraries::instance(null, $class, $config, static::$_classes);
		});
	}