aem-core-wcm-components icon indicating copy to clipboard operation
aem-core-wcm-components copied to clipboard

Container model json omits component properties, includes unnecessary authoring content

Open HitmanInWis opened this issue 1 year ago • 1 comments

Bug present as of version: 2.24.7-SNAPSHOT

At least it seems like a bug to me. The model JSON for a container component omits things like the container ID, the container layout type, and the background style - i.e. fields on com.adobe.cq.wcm.core.components.internal.models.v1.LayoutContainerImpl. The model JSON includes a list of allowedComponents which really shouldnt need to be exported (more of an authoring need).

I believe this is due to the model.json being the AEM default for a responsivegrid component (which container extends). This can be resolved by adding the following to LayoutContainerImpl

@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)

HitmanInWis avatar Jun 04 '24 19:06 HitmanInWis

The above "fix" only changes for the top-level container. For child containers to also display the container ID, layout type, and data layer in the model export, the adapters for LayoutContainerImpl must be updated as well.

        adapters = {LayoutContainer.class, ComponentExporter.class, ContainerExporter.class}, // Add latter 2

HitmanInWis avatar Jun 26 '24 20:06 HitmanInWis