Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

content fragments content inheritance

Avatar

Level 7

hi,

 

I have content fragment created. It has master, sub-variation-one, sub-variation-two.

 

Use case: change different fields in master variation, expecting changes to reflect in sub-variation.

 

Based on documentation : https://experienceleague.adobe.com/en/docs/experience-manager-65/content/assets/content-fragments/co...

 

CAUTION
Synchronization is only available to copy changes from Master to the variation.
Only the current element of the variation is synchronized.
Synchronization only works on the Multi line text data type.
Transferring changes from a variation to Master is not available as an option.
 
only multi line text has sync capability. My client wants all the other data types data also synced.
 
How can I achieve this?
 
Thanks,
Sri
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

Hi @sreenu539 , I think an Adobe support ticket will get help with this as an enhancement but for now maybe you can create an Event Listener to listen for changes to the content fragment resources and trigger the synchronization process. Something like below to check if this works as expected.

 

@Component(service = EventHandler.class,
immediate = true,
property = {
EventConstants.EVENT_TOPIC + "=" + PageEvent.EVENT_TOPIC,
EventConstants.EVENT_FILTER + "=(path=/content/dam/*)"
})
public class ContentFragmentEventListener implements EventHandler {

@Reference
private ResourceResolverFactory resolverFactory;

@Override
public void handleEvent(Event event) {
PageEvent pageEvent = (PageEvent) event;
for (ResourceChange change : pageEvent.getChanges()) {
try (ResourceResolver resolver = resolverFactory.getServiceResourceResolver(null)) {
Resource resource = resolver.getResource(change.getPath());
if (resource != null && isContentFragment(resource)) {
CustomContentFragmentModel model = resource.adaptTo(CustomContentFragmentModel.class);
model.synchronizeVariations(resource.getChild("jcr:content"));
}
} catch (LoginException e) {
// Handle exception
}
}
}

private boolean isContentFragment(Resource resource) {
return resource.getResourceType().equals("dam:Asset");
}
}

Avatar

Administrator

@sreenu539 Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni