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

public method

Brokers access to helpers attached to this rendering context, and loads helpers on-demand if they are not available.

Parameters

  • string $name

    Helper name

  • array $config

Returns

object

Source

	public function helper($name, array $config = array()) {
		if (isset($this->_helpers[$name])) {
			return $this->_helpers[$name];
		}
		try {
			$config += array('context' => $this);
			return $this->_helpers[$name] = Libraries::instance('helper', ucfirst($name), $config);
		} catch (ClassNotFoundException $e) {
			if (ob_get_length()) {
				ob_end_clean();
			}
			throw new RuntimeException("Helper `{$name}` not found.");
		}
	}