{% import 'macros.twig' as macros %} {# === HEADER === header.main_logo -> asset (logo branco) header.menu -> matriz: menu_text, link_href header.btn_text -> plain text header.btn_link -> entry link #} {% set main_logo = header.main_logo.one() ?? null %} {% set secondary_logo = header.secondary_logo.one() ?? null %} {% set btn_href = header.btn_link.url ?? (header.btn_link ?? '#') %} {# Home e Contactos: header claro (transparente sobre fundo escuro). Restantes subpáginas: header dark — variante `.w` (logo/texto escuros sobre fundo claro). #} {% set is_home = craft.app.request.segments|length == 0 %} {% set is_contacts = entry is defined and entry and entry.section.handle == 'contacts' %} {% set dark = not is_home and not is_contacts %} {% set w = dark ? ' w' : '' %} {# === SLIDE MENU (mobile) === header.menu -> matriz: menu_text, link_href, menu (submenu opcional) Abre/fecha via custom.js (.link-meu -> .active) + transição CSS. Itens com submenu (item.menu) viram acordeão; sem submenu, link simples. #}
{% if header.menu|length %} {% for item in header.menu.all() %} {% set item_href = item.link_href.url ?? (item.link_href ?? '#') %} {% set item_target = item.link_href.target ?? '_self' %} {% set has_children = item.menu is defined and item.menu|length %} {% if has_children %} {% else %} {{ macros.limpar_paragrafos(item.menu_text) }} {% endif %} {% endfor %} {% endif %} {{ alternate_lang }}