-
Bug
-
Resolution: Fixed
-
Neutral
-
5.4
-
None
-
None
-
-
Empty show more show less
-
Sprint 4 (Kromeriz)
-
5
I run into this when testing STK + MTK installed alongside (CE).
- MTE installed first
- STK installed second
- opened travel demo (freemarker errors)
- then opened STK demo .. this demo should work, but it didn't because:
- opening the travel demo led to rendering of htmlHeader - AreaElement sets renderType to site and i18nBasename to info.magnolia.module.travel-demo.messages on the corresponding AreaDefinition
- since we are setting these values on the AreaDefinition directly, everytime when we now obtain site's prototype, these values are there leading to incorrect behavior (wrong renderer resolved)
- workaround to this problem is to open site we have configured in the site module as active
Erroneous code (info.magnolia.templating.elements.AreaElement):
// FIXME we shouldn't manipulate the area definition directly // we should use merge with the proxy approach if (areaDefinition instanceof ConfiguredAreaDefinition) { if (areaDefinition.getTemplateScript() == null) { ((ConfiguredAreaDefinition) areaDefinition).setRenderType("noscript"); } else if (areaDefinition.getRenderType() == null) { ((ConfiguredAreaDefinition) areaDefinition).setRenderType(this.templateDefinition.getRenderType()); } if (areaDefinition.getI18nBasename() == null) { ((ConfiguredAreaDefinition) areaDefinition).setI18nBasename(this.templateDefinition.getI18nBasename()); } }
As the FIXME comment suggest, we should use merging utility instead of setting the values directly
Possible fix (worked for me):
ConfiguredAreaDefinition definition = new ConfiguredAreaDefinition(); if (areaDefinition instanceof ConfiguredAreaDefinition) { if (areaDefinition.getTemplateScript() == null) { definition.setRenderType("noscript"); } else if (areaDefinition.getRenderType() == null) { definition.setRenderType(templateDefinition.getRenderType()); } if (areaDefinition.getI18nBasename() == null) { definition.setI18nBasename(templateDefinition.getI18nBasename()); } } definition = BeanMergerUtil.merge(areaDefinition, definition); // Use definition instead of areaDefinition
Acceptance criteria
- is related to
-
MGNLSITE-23 As an administrator, i don't experience weird problems when installing MTE alongside STK or vice versa
- Closed