currentStyle.getPath() not returning complete path

albinissac 19-03-2019

Hello

The current currentStyle.getPath() not returning complete path in publisher but the same is working fine in Author instance.

e.g currentStyle.getPath() returning /etc/designs/default/jcr:content/homepage but the expected value is /etc/designs/default/jcr:content/homepage/testcomponent

any expert idea?

Regards

Albin I

Accepted Solutions (1)

Accepted Solutions (1)

gauravb41175071
MVP
21-03-2019

this snippet is used to remove extra decorator tags in publish server/preview mode on author. You may choose to remove this snippet or move the code "currentStyle.getPath()"/your component out of this block and test it.

Refer -

https://aemcorner.com/aem-how-to-remove-div-wrapper-from-component/

http://www.sotheanim.com/35-how-to-get-rid-of-decorative-div-wrapper-from-aem-component

(ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE, false) would remove wrapper DIV for all next rendered components until the request is run out or you explicitly disable it.

Since it removes the extra wrapper containers, it might be an issue with how you utilize it

Answers (6)

Answers (6)

paradox8071 20-03-2019

one thing that you can check is that you are not doing anything specific to publish mode in your code. i.e

if (wcmmode.disabled) {

          //something that effect currentStyle Path

}

albinissac 21-03-2019

Based on my further analysis it looks to be the path is different between Author and Publisher due to the below code

if (!getWcmMode().isEdit() && !getWcmMode().isDesign()) {

IncludeOptions.getOptions(getRequest(), true).forceSameContext(true);

getRequest().setAttribute(ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE, false);

}

But i am not able to understand why the currentStyle path is different due to the above code, can you please explain?

Regards

Albin I

Jörg_Hoh
Employee
20-03-2019

Hi,

it might be an issue with permissions. You probably can access /etc/designs but not the /etc/ node (AEM 6.4 comes with a new set of permissions, especially regarding /etc/). I would avoid to use that API call and someone will probably recommend to drop /etc/design completely because the design is no longer en vogue, but you are supposed to use the style system or more recent AEM versions ...

Jörg

smacdonald2008 20-03-2019

This does not make sense - as they are both the same software versions and same API call. Can you show your entire code so the community can see if they can spot something,