lithium\template\view\Renderer::__call()

public method

Dispatches method calls for (a) rendering context values or (b) applying handlers to pieces of content. If $method is a key in Renderer::$_context, the corresponding context value will be returned (with the value run through a matching handler if one is available). If $method is a key in Renderer::$_handlers, the value passed as the first parameter in the method call will be passed through the handler and returned.

Parameters

  • string $method

    The method name to call, usually either a rendering context value or a content handler.

  • array $params

Returns

mixed

Source

	public function __call($method, $params) {
		if (!isset($this->_context[$method]) && !isset($this->_handlers[$method])) {
			return isset($params[0]) ? $params[0] : null;
		}
		if (!isset($this->_handlers[$method]) && !$params) {
			return $this->_context[$method];
		}
		if (isset($this->_context[$method]) && $params) {
			if (is_array($this->_context[$method])) {
				$this->_context[$method][] = $params[0];
			} else {
				$this->_context[$method] = $params[0];
			}
		}
		if (!isset($this->_context[$method])) {
			$params += array(null, array());
			return $this->applyHandler(null, null, $method, $params[0], $params[1]);
		}
		return $this->applyHandler(null, null, $method, $this->_context[$method]);
	}