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

Hello @nitrohazedev ,

See this chart, where the same component is on a page. Once it drops the page directly by parsys, another one comes from XF. This result is from the Slightly.

Now, you can question why it happened. The answer is by XF the component is already rendered and comes to the page. Using slightly code you will get a wrong output.

 

So, in my solution, I suggest using the Sling Model class. Then why will Java work?
Java sends the output based on the server instance, not in frontend page mode.

I hope it will make a clear visibility for your confusion. If not, please don't hesitate to ask.

 


Thanks @sady_rifat  .. but the ask is in page mode vs server instance .. as the authors would prefer testing for disabled or preview mode. Also, I see that wcmmode works for edit on XF where message is displayed on edit mode  but issue is when it is within a building block that is when it does not pick up mode. 

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.