lithium\template\View::_step PHP Method

_step() protected method

Performs a rendering step.
See also: lithium\template\view\adapter\File::template()
See also: lithium\template\view\Renderer::render()
See also: lithium\template\view\adapter\File::render()
protected _step ( array $step, array $params, array &$data, array &$options = [] ) : string
$step array The array defining the step configuration to render.
$params array An associative array of string values used in the template lookup process. See the `$params` argument of `File::template()`.
$data array associative array for template data.
$options array An associative array of options to pass to the renderer. See the `$options` parameter of `Renderer::render()` or `File::render()`.
return string
    protected function _step(array $step, array $params, array &$data, array &$options = array())
    {
        $step += array('path' => null, 'capture' => null);
        $_renderer = $this->_renderer;
        $_loader = $this->_loader;
        $filters = $this->outputFilters;
        $params = compact('step', 'params', 'options') + array('data' => $data + $filters, 'loader' => $_loader, 'renderer' => $_renderer);
        $filter = function ($self, $params) {
            $template = $params['loader']->template($params['step']['path'], $params['params']);
            return $params['renderer']->render($template, $params['data'], $params['options']);
        };
        $result = $this->_filter(__METHOD__, $params, $filter);
        if (is_array($step['capture'])) {
            switch (key($step['capture'])) {
                case 'context':
                    $options['context'][current($step['capture'])] = $result;
                    break;
                case 'data':
                    $data[current($step['capture'])] = $result;
                    break;
            }
        }
        return $result;
    }