gastroshop/frontend/plugins/advanced_menu/index.tpl
2020-02-11 16:05:17 +01:00

102 lines
5.6 KiB
Smarty

{function name="categories_top" level=0}
{$columnIndex = 0}
{$menuSizePercentage = 100 - (20 * $columnAmount * intval($hasTeaser))}
{$columnCount = 4 - ($columnAmount * intval($hasTeaser))}
<ul class="menu--list menu--level-{$level}">
{block name="frontend_plugins_advanced_menu_list"}
{foreach $categories as $category}
{if $category.hideTop}
{continue}
{/if}
{$categoryLink = $category.link}
{if $category.external}
{$categoryLink = $category.external}
{/if}
<li class="menu--list-item item--level-{$level}">
{block name="frontend_plugins_advanced_menu_list_item"}
{if $category.media.path}
<a class="sub--nav-link" href="{$categoryLink|escapeHtml}"
aria-label="{$category.name|escape}"
title="{$category.name|escape}"{if $category.external && $category.externalTarget} target="{$category.externalTarget}"{/if}>
<img class="sub--nav-image thumb"
alt="{$category.name|escape}"
src="{link file={$category.media.path} fullPath}" />
<span class="sub--nav-title">{$category.name|escape}</span>
</a>
{else}
<a href="{$categoryLink|escapeHtml}" class="menu--list-item-link" title="{$category.name|escape}">{$category.name}</a>
{/if}
{if $category.sub}
{call name=categories_top categories=$category.sub level=$level+1}
{/if}
{/block}
</li>
{/foreach}
{/block}
</ul>
{/function}
<div class="advanced-menu" data-advanced-menu="true" data-hoverDelay="{$hoverDelay}">
{block name="frontend_plugins_advanced_menu"}
{foreach $sAdvancedMenu as $mainCategory}
{if !$mainCategory.active || $mainCategory.hideTop}
{continue}
{/if}
{$link = $mainCategory.link}
{if $mainCategory.external}
{$link = $mainCategory.external}
{/if}
{$hasCategories = $mainCategory.activeCategories > 0 && $columnAmount < 4}
{$hasTeaser = (!empty($mainCategory.media) || !empty($mainCategory.cmsHeadline) || !empty($mainCategory.cmsText)) && $columnAmount > 0}
<div class="menu--container">
{block name="frontend_plugins_advanced_menu_main_container"}
{if $hasCategories || $hasTeaser}
<div class="content--wrapper{if $hasCategories} has--content{/if}{if $hasTeaser} has--teaser{/if}">
{if $hasCategories}
{block name="frontend_plugins_advanced_menu_sub_categories"}
{call name="categories_top" categories=$mainCategory.sub}
{/block}
{/if}
{if $hasTeaser}
{block name="frontend_plugins_advanced_menu_teaser"}
{if $hasCategories}
<div class="menu--delimiter" style="right: {$columnAmount * 25}%;"></div>
{/if}
<div class="menu--teaser"{if $hasCategories} style="width: {$columnAmount * 25}%;"{else} style="width: 100%;"{/if}>
{if !empty($mainCategory.media)}
<a href="{$link|escapeHtml}" aria-label="{s name="toCategoryBtn" namespace="frontend/plugins/advanced_menu/advanced_menu"}{/s}{$mainCategory.name|escape:'html'}" title="{s name="toCategoryBtn" namespace="frontend/plugins/advanced_menu/advanced_menu"}{/s}{$mainCategory.name|escape:'html'}" class="teaser--image" style="background-image: url({link file={$mainCategory.media.path}});"{if $mainCategory.external && $category.externalTarget} target="{$mainCategory.externalTarget}"{/if}></a>
{/if}
{if !empty($mainCategory.cmsHeadline)}
<div class="teaser--headline">{$mainCategory.cmsHeadline}</div>
{/if}
{if !empty($mainCategory.cmsText)}
<div class="teaser--text">
{$mainCategory.cmsText|strip_tags|truncate:250:"..."}
<a class="teaser--text-link" href="{$link|escapeHtml}" aria-label="{s name="learnMoreLink" namespace="frontend/plugins/advanced_menu/advanced_menu"}mehr erfahren{/s}" title="{s name="learnMoreLink" namespace="frontend/plugins/advanced_menu/advanced_menu"}mehr erfahren{/s}">
{s name="learnMoreLink" namespace="frontend/plugins/advanced_menu/advanced_menu"}mehr erfahren{/s}
</a>
</div>
{/if}
</div>
{/block}
{/if}
</div>
{/if}
{/block}
</div>
{/foreach}
{/block}
</div>