{block name="et-links-recursive"}
    {if isset($currentLink)}
        {et_isShopVersionAtLeast value="5.2.0-beta" assign='shopIsAtLeast52'}
        {$activeId=$activeId|default:0}
        {$limit=$limit|default:-1}
        {$discreetLinks=$discreetLinks|default:false}
        {if $activeId === 0}
            {if isset($Link) && $Link->getID() > 0}
                {assign var=activeId value=$Link->getID()}
            {elseif JTL\Shop::$kLink > 0}
                {assign var=activeId value=JTL\Shop::$kLink}
            {/if}
        {/if}
        {$level=$level|default:0}
        {$cssPrefix=$cssPrefix|default:'et-links-recursive'}
        {$cssClass=$cssClass|default:''}
        {block name="et-links-recursive-wrapper"}
            <div class="{block name="et-links-recursive-wrapper-class"}{$cssPrefix}-wrapper {$cssPrefix}-level-{$level}{if !empty($cssClass) && $level === 0} {$cssClass}{/if}{/block}">
                {block name="et-links-recursive-link"}
                    <a href="{$currentLink->getURL()}" class="{block name="et-links-recursive-link-class"}{$cssPrefix}-link{if $discreetLinks} link-discreet{/if}{if $activeId === $currentLink->getID()} active{/if}{/block}"{if $currentLink->getNoFollow()} rel="nofollow"{/if}{if $shopIsAtLeast52} target="{$currentLink->getTarget()}"{/if}>
                        {$currentLink->getName()}
                    </a>
                {/block}
                {block name="et-links-recursive-child-links"}
                    {if $limit >= 0 && $level < $limit}
                        {foreach $currentLink->getChildLinks() as $childLink}
                            {include file='widgets/snippets/links_recursive.tpl'
                                limit=$limit
                                currentLink=$childLink
                                level=intval(level)+1
                                cssPrefix=$cssPrefix
                                activeId=$activeId
                                discreetLinks={$discreetLinks}
                            }
                        {/foreach}
                    {/if}
                {/block}
            </div>
        {/block}
    {/if}
{/block}