AEM 6.5 experience fragment containing building block and wcmmode | Community
Skip to main content
Level 9
October 16, 2023

AEM 6.5 experience fragment containing building block and wcmmode

  • October 16, 2023
  • 3 replies
  • 2619 views

Hi ,

 

I was playing around with experience fragments and noted that if a component even core component with a check on wcmmode.edit is done in sightly , and is included on XF, it does not pick up the mode in preview or disabled mode(view as published) within XF if the component is included within a building block. 

This impacts the webpage when wcmmode disabled when XF is included with a building block. 

 

eg, I want a component to have a message if authoring mode or wcmmode is edit and in preview or disabled mode the component should not show the message on an XF and when XF is included on webpage and if the components are part of building block within the XF


1.  if the component is added within the building block , the same behavior is noted and, if you check with wcmmodes.isTouchAuthoring , it works only on wcmmode disabled and NOT preview .. 

 

Observed this behavior OOTB core components , should !wcmmode.disabled be used ? 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

Sady_Rifat
Community Advisor
Community Advisor
October 16, 2023

Hello @nitrohazedev ,
The wcmmode for Experience Fragment on a page differs from its editing mode.
There is a similar thread that describes why it behaves like that and how can you get the expected solution: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/when-putting-a-custom-component-inside-an-experience-fragment/m-p/586060 

Level 9
October 16, 2023

Hi @sady_rifat  thank you for the response .. I apologize firstly that I missed details and mistyped the question .. confusing the observations .. updated the original question .. the link as I see the answer is in relation to author or pub ? And not modes ,  .. also if sightly does not wonder if backend will via models with approach listed  .. I managed to find the option above using istouchauthoring, that works for view as published but not preview .. not sure if recommended .. gonna test today for !criteria but since it occurs OOTB , wondering any way vs models ? 

Level 9
October 17, 2023

Exactly that's the case,

When you edit an experience fragment you basically edit a page. (ex: experience fragment page template). On that page, wcmmode behaves as a regular pattern. And you get your desired value.
Note: Here I am talking about (/aem/experience-fragments.html/content/experience-fragments/aem-project-demo/us/en/site/header/master) 

 

Now come to the sites (/sites.html/content/aem-project-demo/us/en)

In this page template, you dropped an XF component and referenced the XF variation link.
Now what happens, the XF component renders the variation and shows you as a publish mode. Because it's already rendered and referenced from another source.
That is why in the author mode all wcmmode properties give publish value.

Maybe you already noticed that, in the XF section you cannot edit any component, the full section is disabled.


I think there’s a confusion and pardon me if I have not stated it clearly @sady_rifat .. the modes are picked incorrectly when the component is within building block  and if not within building block I see it works fine .. no corner case noticed so far 

kautuk_sahni
Community Manager
Community Manager
October 16, 2023

@nitrohazedev Did you find the suggestions from Sady helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni
Level 9
October 25, 2023

@sady_rifat  the adobe engineers came back saying they have a ticket raised for it to resolve after internal discussions  

SITES-16835.