mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/structural_pages.git
synced 2026-05-05 18:35:29 -03:00
Adiciona field_menu_title e field_weight ao content_page
field_menu_title (string, 128 chars): - Título alternativo para exibição no menu de navegação - Quando preenchido, substitui o título da página no menu - Útil para abreviar títulos longos field_weight (integer, padrão 0): - Controla a ordenação de páginas com o mesmo pai - Valores menores aparecem primeiro; empate resolvido por título StructuralPagesMenuBlock: - Ordenação: field_weight ASC, título ASC (antes: só título) - Título no menu: field_menu_title se preenchido, senão label() Update 10014: cria os campos e atualiza o form display em instalações existentes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -351,10 +351,14 @@ class StructuralPagesMenuBlock extends BlockBase implements ContainerFactoryPlug
|
||||
}
|
||||
}
|
||||
|
||||
$menu_title = ($node->hasField('field_menu_title') && !$node->get('field_menu_title')->isEmpty())
|
||||
? $node->get('field_menu_title')->value
|
||||
: $node->label();
|
||||
|
||||
$branch = [
|
||||
'entity' => $node,
|
||||
'id' => $node->id(),
|
||||
'title' => $node->label(),
|
||||
'title' => $menu_title,
|
||||
'url' => $url,
|
||||
'is_redirect' => $is_redirect,
|
||||
'depth' => $current_depth,
|
||||
@@ -425,6 +429,7 @@ class StructuralPagesMenuBlock extends BlockBase implements ContainerFactoryPlug
|
||||
->accessCheck(TRUE)
|
||||
->condition('type', 'content_page')
|
||||
->condition('status', 1)
|
||||
->sort('field_weight', 'ASC')
|
||||
->sort('title', 'ASC');
|
||||
|
||||
if ($parent_type === 'node') {
|
||||
|
||||
Reference in New Issue
Block a user