src/Renderer/StringTemplateRenderer.php
protected function _renderNested(ItemInterface $item, array $options)
    {
        if (!$item->hasChildren() ||
            $options['depth'] === 0 ||
            !$item->getDisplayChildren()
        ) {
            return '';
        }

        $templater = $this->templater();

        $attributes = $this->_formatAttributes($options['attributes'], $item);
        unset($options['attributes']);

        $templateVars = $options['templateVars'];
        unset($options['templateVars']);

        $newTemplates = $options['childrenTemplates'];
        unset($options['childrenTemplates']);
        if ($newTemplates) {
            $templater->push();
            $templater->add($newTemplates);
        }

        $items = $this->_renderChildren($item, $options);

        if ($newTemplates) {
            $templater->pop();
        }

        return (string)$templater->format('nest', [
            'attrs' => $attributes,
            'templateVars' => $templateVars,
            'items' => $items
        ]);
    }
protected function _renderNested(ItemInterface $item, array $options)
    {
        if (!$item->hasChildren() ||
            $options['depth'] === 0 ||
            !$item->getDisplayChildren()
        ) {
            return '';
        }

        $templater = $this->templater();

        $attributes = $this->_formatAttributes($options['attributes'], $item);
        unset($options['attributes']);

        $templateVars = $options['templateVars'];
        unset($options['templateVars']);

        $newTemplates = $options['childrenTemplates'];
        unset($options['childrenTemplates']);
        if ($newTemplates) {
            $templater->push();
            $templater->add($newTemplates);
        }

        $items = $this->_renderChildren($item, $options);

        if ($newTemplates) {
            $templater->pop();
        }

        return (string)$templater->format('nest', [
            'attrs' => $attributes,
            'templateVars' => $templateVars,
            'items' => $items
        ]);
    }
protected function _renderNested ( ItemInterface $ item , array $ options ) { if ( ! $ item -> hasChildren ( ) || $ options [ 'depth' ] === 0 || ! $ item -> getDisplayChildren ( ) ) { return '' ; } $ templater = $ this -> templater ( ) ; $ attributes = $ this -> _formatAttributes ( $ options [ 'attributes' ] , $ item ) ; unset ( $ options [ 'attributes' ] ) ; $ templateVars = $ options [ 'templateVars' ] ; unset ( $ options [ 'templateVars' ] ) ; $ newTemplates = $ options [ 'childrenTemplates' ] ; unset ( $ options [ 'childrenTemplates' ] ) ; if ( $ newTemplates ) { $ templater -> push ( ) ; $ templater -> add ( $ newTemplates ) ; } $ items = $ this -> _renderChildren ( $ item , $ options ) ; if ( $ newTemplates ) { $ templater -> pop ( ) ; } return ( string ) $ templater -> format ( 'nest' , [ 'attrs' => $ attributes , 'templateVars' => $ templateVars , 'items' => $ items ] ) ; }
Renders the menu items children in a to be nested element.

## Options

- `attributes`: The HTML attributes to apply to the element.
- `templateVars`: The template variables to use for the element.
- `childrenTemplates`: The templates to use for the children of the element.

@param ItemInterface $item The menu whose children to render.
@param array $options The rendering options, see the "Options" section in the method
description for specific nesting element options.
@return string The rendered element.
Renders the menu items children in a to be nested element .