lithium\template\view\Renderer::helper PHP Méthode

helper() public méthode

Brokers access to helpers attached to this rendering context, and loads helpers on-demand if they are not available.
public helper ( string $name, array $config = [] ) : object
$name string Helper name
$config array
Résultat object
    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.");
        }
    }