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);


  • string $method

    name of method that is calling the render (for context filters)

  • string $string

    template key (in Helper::_strings) to render

  • array $params

    associated array of template inserts {:key} will be replaced by value

  • array $options

    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.



Rendered HTML


	protected function _render($method, $string, $params, array $options = []) {
		$strings = $this->_strings;

		if (isset($params['options']['scope'])) {
			$options['scope'] = $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 Text::insert(isset($strings[$string]) ? $strings[$string] : $string, $params);