lithium\template\Helper::_render PHP Method

_render() protected method

Render a string template after applying context filters Use examples in the Html::link() method: return $this->_render(__METHOD__, 'link', compact('title', 'url', 'options'), $scope);
protected _render ( string $method, string $string, array $params, array $options = [] ) : string
$method string name of method that is calling the render (for context filters)
$string string template key (in Helper::_strings) to render
$params array associated array of template inserts {:key} will be replaced by value
$options array Available options: - `'handlers'` _array_: Before inserting `$params` inside the string template, `$this->_context`'s handlers are applied to each value of `$params` according to the key (e.g `$params['url']`, which is processed by the `'url'` handler via `$this->_context->applyHandler()`). The `'handlers'` option allow to set custom mapping beetween `$params`'s key and `$this->_context`'s handlers. e.g. the following handler: `'handlers' => array('url' => 'path')` will make `$params['url']` to be processed by the `'path'` handler instead of the `'url'` one.
return string Rendered HTML
    protected function _render($method, $string, $params, array $options = array())
    {
        $strings = $this->_strings;
        if (isset($params['options']['scope'])) {
            $options['scope'] = $params['options']['scope'];
            unset($params['options']['scope']);
        }
        if ($this->_context) {
            foreach ($params as $key => $value) {
                $handler = isset($options['handlers'][$key]) ? $options['handlers'][$key] : $key;
                $params[$key] = $this->_context->applyHandler($this, $method, $handler, $value, $options);
            }
            $strings = $this->_context->strings();
        }
        return String::insert(isset($strings[$string]) ? $strings[$string] : $string, $params);
    }