When the Embed component is used with an Embeddable (e.g. YouTube) the JSON model export does not include the embeddable, and thus omits all relevant details required to render in a non-AEM system.
This can be remediated with the following steps:
Update Embeddable interface to extend ComponentExporter
Update YouTube model to specify explicit resourceType and then add adapters of Embeddable.class, ComponentExporter.class
Add an isConfigured function to the Embeddable interface
Add the following code to EmbedImpl
@Override
public @Nullable Embeddable getEmbeddable() {
if (embeddable == null && StringUtils.isNotBlank(embeddableResourceType)) {
Resource embeddableResource = new CoreResourceWrapper(resource, embeddableResourceType);
embeddable = modelFactory.getModelFromWrappedRequest(request, embeddableResource, Embeddable.class);
if (embeddable == null) {
LOGGER.warn("Unable to cast embed {} to embeddable type {}", resource.getPath(), embeddableResourceType);
}
}
return embeddable != null && embeddable.isConfigured() ? embeddable : null;
}
Bug present as of version: 2.24.7-SNAPSHOT
When the
Embed
component is used with anEmbeddable
(e.g. YouTube) the JSON model export does not include the embeddable, and thus omits all relevant details required to render in a non-AEM system.This can be remediated with the following steps:
Embeddable
interface to extendComponentExporter
YouTube
model to specify explicitresourceType
and then add adapters ofEmbeddable.class, ComponentExporter.class
isConfigured
function to theEmbeddable
interfaceEmbedImpl