mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/structural_pages.git
synced 2026-03-10 18:37:41 -03:00
Altera lógica de Site Section e adiciona redirect em content_page
- Adiciona campo field_redirect_link (link) no bundle content_page; EventSubscriber emite redirect 301 quando o campo está preenchido - field_site_section passa a ser obrigatório - Formulário de content_page: AJAX no site section, select hierárquico de página pai filtrado por seção, validação customizada - StructuralPagesMenuBlock: MAX_DEPTH 10→50, nova lógica de raiz via field_site_section, variável ancestor_url no render array - Template do menu: novas classes BEM/Gva, suporte a is_redirect, usa ancestor_url em vez de chamada Twig direta - CSS do menu reescrito com estilos flyout/sidebar; Select2 adicionado para o campo de página pai no formulário admin - display_submitted desabilitado no tipo content_page Co-Authored-By: Bauer <henrique@webcontent.com.br> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,22 +18,26 @@
|
||||
#}
|
||||
{{ attach_library('structural_pages/menu') }}
|
||||
{% if tree is not empty %}
|
||||
<nav class="structural-pages-menu" aria-label="{{ 'Site structure navigation'|t }}">
|
||||
<nav class="block-menu navigation structural-pages-menu" aria-label="{{ 'Site structure navigation'|t }}">
|
||||
{% if show_ancestor_title and ancestor %}
|
||||
<h2 class="structural-pages-menu__title">
|
||||
{% if ancestor.toUrl is defined %}
|
||||
<a href="{{ ancestor.toUrl }}">{{ ancestor.label }}</a>
|
||||
<h2 class="structural-pages-menu__title block-title">
|
||||
<span>
|
||||
{% if ancestor_url %}
|
||||
<a href="{{ ancestor_url }}">{{ ancestor.label }}</a>
|
||||
{% else %}
|
||||
{{ ancestor.label }}
|
||||
{% endif %}
|
||||
</span>
|
||||
</h2>
|
||||
{% endif %}
|
||||
|
||||
<ul class="structural-pages-menu__list structural-pages-menu__list--level-1">
|
||||
{% for item in tree %}
|
||||
{{ _self.menu_item(item, active_trail, 1) }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="block-content">
|
||||
<ul class="gva_menu structural-pages-menu__list structural-pages-menu__list--level-1">
|
||||
{% for item in tree %}
|
||||
{{ _self.menu_item(item, active_trail, 1) }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
@@ -41,19 +45,20 @@
|
||||
{% 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 ? 'structural-pages-menu__item--active-trail',
|
||||
has_children ? 'structural-pages-menu__item--has-children',
|
||||
is_active ? 'menu-item--active-trail structural-pages-menu__item--active-trail',
|
||||
has_children ? 'menu-item--expanded structural-pages-menu__item--has-children',
|
||||
] %}
|
||||
|
||||
<li{{ create_attribute().addClass(classes) }}>
|
||||
<a href="{{ item.url }}" class="structural-pages-menu__link{% if is_active %} structural-pages-menu__link--active-trail{% endif %}">
|
||||
<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="structural-pages-menu__list structural-pages-menu__list--level-{{ depth + 1 }}">
|
||||
<ul class="menu sub-menu structural-pages-menu__list structural-pages-menu__list--level-{{ depth + 1 }}">
|
||||
{% for child in item.children %}
|
||||
{{ _self.menu_item(child, active_trail, depth + 1) }}
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user