Fix/implement cascade for content adapters

Fixes #13692
This commit is contained in:
Bjørn Erik Pedersen
2025-05-07 10:40:39 +02:00
parent 9d1d8c8899
commit c745a3e108
11 changed files with 273 additions and 79 deletions

View File

@@ -91,17 +91,20 @@ func (p *pagesFromDataTemplateContext) AddPage(v any) (string, error) {
pd := pagemeta.DefaultPageConfig
pd.IsFromContentAdapter = true
pd.ContentAdapterData = m
if err := mapstructure.WeakDecode(m, &pd); err != nil {
return "", fmt.Errorf("failed to decode page map: %w", err)
// The rest will be handled after the cascade is calculated and applied.
if err := mapstructure.WeakDecode(pd.ContentAdapterData, &pd.PageConfigEarly); err != nil {
err = fmt.Errorf("failed to decode page map: %w", err)
return "", err
}
p.p.buildState.NumPagesAdded++
if err := pd.Validate(true); err != nil {
return "", err
}
p.p.buildState.NumPagesAdded++
return "", p.p.HandlePage(p.p, &pd)
}