mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/structural_pages.git
synced 2026-05-05 02:10:40 -03:00
Refatora CSS e templates do menu estrutural
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>
This commit is contained in:
39
templates/structural-pages-menu-item.html.twig
Normal file
39
templates/structural-pages-menu-item.html.twig
Normal file
@@ -0,0 +1,39 @@
|
||||
{#
|
||||
/**
|
||||
* @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>
|
||||
Reference in New Issue
Block a user