mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/structural_pages.git
synced 2026-05-04 18:30:41 -03:00
Reescreve structural-pages-menu.css com layout horizontal como padrão (análogo ao microsite-nav) e flyout lateral apenas em contexto sidebar. Extrai renderização de itens para structural-pages-menu-item.html.twig e adiciona link "Home" apontando para a URL do ancestral. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1.5 KiB
Twig
40 lines
1.5 KiB
Twig
{#
|
|
/**
|
|
* @file
|
|
* Template for a single structural pages menu item (recursive).
|
|
*
|
|
* Available variables:
|
|
* - item: Menu item array with keys:
|
|
* - id: Node ID.
|
|
* - title: Node title.
|
|
* - url: Node URL string.
|
|
* - is_redirect: Whether the link is a redirect.
|
|
* - children: Array of child items.
|
|
* - active_trail: Array of node IDs in the active trail.
|
|
* - depth: Current depth level (integer).
|
|
*/
|
|
#}
|
|
{% set is_active = item.id in active_trail %}
|
|
{% set has_children = item.children is not empty %}
|
|
{% set classes = [
|
|
'menu-item',
|
|
'structural-pages-menu__item',
|
|
'structural-pages-menu__item--level-' ~ depth,
|
|
is_active ? 'menu-item--active-trail structural-pages-menu__item--active-trail' : '',
|
|
has_children ? 'menu-item--expanded structural-pages-menu__item--has-children' : '',
|
|
]|filter(c => c is not empty)|join(' ') %}
|
|
|
|
<li class="{{ classes }}">
|
|
<a href="{{ item.url }}"{% if item.is_redirect %} target="_blank"{% endif %} class="structural-pages-menu__link{% if is_active %} is-active structural-pages-menu__link--active-trail{% endif %}">
|
|
{{- item.title -}}
|
|
</a>
|
|
|
|
{% if has_children %}
|
|
<ul class="menu sub-menu structural-pages-menu__list structural-pages-menu__list--level-{{ depth + 1 }}">
|
|
{% for child in item.children %}
|
|
{% include '@structural_pages/structural-pages-menu-item.html.twig' with {'item': child, 'active_trail': active_trail, 'depth': depth + 1} only %}
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</li>
|