Refatora arquitetura de domínio: field_site_section DER, field_parent_page node-only

- field_site_section migrado de entity_reference para dynamic_entity_reference,
  permitindo referenciar taxonomy_term, user ou event como domínio raiz da página
- field_parent_page restrito a content_page nodes apenas (removidos taxonomy_term/user)
- Update hooks 10011–10013: migração de schema/config, limpeza de referências
  inválidas e correção do tipo do storage field_parent_page para DER
- SectionBreadcrumbBuilder reescrito para usar field_site_section como raiz
- StructuralPagesMenuBlock: queries de domínio via DB direto (evita bug do
  entity query com especificador target_type em campos DER)
- Formulário content_page: pre-fill de field_site_section via query params
  ?domain_type/domain_id ou ?parent_section_type/parent_id; atualiza widget
  #default_value diretamente para refletir o valor na renderização inicial
- Parâmetro de URL parent_type renomeado para parent_section_type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-20 09:41:17 -03:00
parent 6ab880045a
commit d2ef439227
9 changed files with 894 additions and 370 deletions

View File

@@ -4,8 +4,6 @@ dependencies:
config:
- field.storage.node.field_parent_page
- node.type.content_page
- node.type.section_page
- taxonomy.vocabulary.site_sections
module:
- dynamic_entity_reference
id: node.content_page.field_parent_page
@@ -13,7 +11,7 @@ field_name: field_parent_page
entity_type: node
bundle: content_page
label: 'Parent Page'
description: 'Selecione a entidade pai. A seção do site será herdada automaticamente com base no tipo de pai.'
description: 'Selecione a página content_page pai dentro do mesmo domínio. Deixe vazio para criar uma página raiz.'
required: false
translatable: false
default_value: { }
@@ -21,24 +19,13 @@ default_value_callback: ''
settings:
entity_type_ids:
- node
- taxonomy_term
node:
handler: 'default:node'
handler_settings:
target_bundles:
content_page: content_page
section_page: section_page
sort:
field: title
direction: asc
auto_create: false
taxonomy_term:
handler: 'default:taxonomy_term'
handler_settings:
target_bundles:
site_sections: site_sections
sort:
field: name
direction: asc
auto_create: false
field_type: dynamic_entity_reference

View File

@@ -6,24 +6,40 @@ dependencies:
- node.type.content_page
- taxonomy.vocabulary.site_sections
module:
- dynamic_entity_reference
- taxonomy
id: node.content_page.field_site_section
field_name: field_site_section
entity_type: node
bundle: content_page
label: 'Seção do Site'
description: 'For root pages, select the section. For child pages, this field is filled automatically.'
description: 'Para páginas raiz, selecione a seção ou domínio. Para páginas filhas, este campo é preenchido automaticamente a partir do pai.'
required: true
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:taxonomy_term'
handler_settings:
target_bundles:
site_sections: site_sections
sort:
field: name
direction: asc
auto_create: false
field_type: entity_reference
entity_type_ids:
- taxonomy_term
- user
taxonomy_term:
handler: 'default:taxonomy_term'
handler_settings:
target_bundles:
site_sections: site_sections
sort:
field: name
direction: asc
auto_create: false
user:
handler: 'default:user'
handler_settings:
include_anonymous: false
filter:
type: _none
target_bundles: null
sort:
field: name
direction: asc
auto_create: false
field_type: dynamic_entity_reference

View File

@@ -6,6 +6,7 @@ dependencies:
- node.type.section_page
- taxonomy.vocabulary.site_sections
module:
- dynamic_entity_reference
- taxonomy
id: node.section_page.field_site_section
field_name: field_site_section
@@ -18,12 +19,15 @@ translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:taxonomy_term'
handler_settings:
target_bundles:
site_sections: site_sections
sort:
field: name
direction: asc
auto_create: false
field_type: entity_reference
entity_type_ids:
- taxonomy_term
taxonomy_term:
handler: 'default:taxonomy_term'
handler_settings:
target_bundles:
site_sections: site_sections
sort:
field: name
direction: asc
auto_create: false
field_type: dynamic_entity_reference

View File

@@ -10,7 +10,8 @@ entity_type: node
type: dynamic_entity_reference
settings:
exclude_entity_types: false
entity_type_ids: []
entity_type_ids:
- node
module: dynamic_entity_reference
locked: false
cardinality: 1

View File

@@ -2,15 +2,19 @@ langcode: en
status: true
dependencies:
module:
- dynamic_entity_reference
- node
- taxonomy
id: node.field_site_section
field_name: field_site_section
entity_type: node
type: entity_reference
type: dynamic_entity_reference
settings:
target_type: taxonomy_term
module: core
exclude_entity_types: false
entity_type_ids:
- taxonomy_term
- user
module: dynamic_entity_reference
locked: false
cardinality: 1
translatable: true