currentStyle.getPath() not returning complete path | Community
Skip to main content
Community Advisor
March 20, 2019
Solved

currentStyle.getPath() not returning complete path

  • March 20, 2019
  • 7 replies
  • 4989 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Gaurav-Behl

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

7 replies

arunpatidar
Community Advisor
Community Advisor
March 20, 2019

Can you check the path in preview mode and disabled mode on author?

What AEM Version are you using?

Arun Patidar
AlbinIs1Community AdvisorAuthor
Community Advisor
March 20, 2019

The path is looking fine in Author but the issue is observed in Publisher.

AEM version is - 6.4.3.0

Regards

Albin I

smacdonald2008
Level 10
March 20, 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,

paradox8071
Level 2
March 20, 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

}

joerghoh
Adobe Employee
Adobe Employee
March 20, 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

AlbinIs1Community AdvisorAuthor
Community Advisor
March 21, 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

Gaurav-Behl
Gaurav-BehlAccepted solution
Level 10
March 21, 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