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`.
This method can be filtered.

Source

						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) {
			$data = $params['data'];
			$options = $params['options'];
			$handler = $params['handler'];
			$response =& $params['response'];

			if (!is_array($handler)) {
				$handler = $self::invokeMethod('_handlers', array($handler));
			}
			$class = $handler['view'];
			unset($handler['view']);

			$config = $handler + array('response' => &$response);
			return $self::invokeMethod('_instance', array($class, $config));
		});
	}