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
  • 2593 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 ? 

Sady_Rifat
Community Advisor
Community Advisor
October 16, 2023

Hello @nitrohazedev ,

The answer is related to the author's instance. The Slightly code doesn't detect the wcmmode edit because the XF is rendered from a different path on the page. When you want to use wcmmode edit it's always like/behaves view as publish mode.
The Solution is linked to a Model class since according to the best practice every associate component will have a model class.

Again since slightly depends on page mode,  you cannot rely on this, you need to find the actual instance by Java.

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.