Change rootPath of the pathbrowser depending on the context where the component is added | Community
Skip to main content
Peter_Puzanovs
Community Advisor
Community Advisor
June 30, 2017
Solved

Change rootPath of the pathbrowser depending on the context where the component is added

  • June 30, 2017
  • 7 replies
  • 7667 views

Have requirement: when component with pathfield in the dialog is dropped on site A, the pathfield rootPath should become /path/to/site/A

When the same component is dropped on site B, the pathfield rootPath should become /path/to/site/B

How would one achieve this in AEM with minimalistic amount of changes?

Regards,

Peter

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 leeasling1

I totally understand your hesitation with it, and if it was more than just overlaying the dialog I would agree it's probably not a good approach, but the view/business logic stays the same between components.  You're either going to have to maintain JavaScript to customize, or use OOTB functionality to overlay only the dialog. 

7 replies

Nupur_Jain
Adobe Employee
Adobe Employee
June 30, 2017

Hi,

Is it Touch UI dialog or classic UI?

Peter_Puzanovs
Community Advisor
Community Advisor
June 30, 2017

Good question, sorry should have mentioned it before,

Touch UI AEM 6.3

Level 3
June 30, 2017

I don't believe there is a clean code solution to this simply because of what the UI outputs for the data attributes.

What may be a better idea to consider is overlay your current component with a new one and only change the dialog.  This way you can give the component a different group and a different root path very cleanly.  On site A you allow component 1, on site B you allow component 2.  Simple and clean.

Peter_Puzanovs
Community Advisor
Community Advisor
June 30, 2017

Thank you for your reply,

Problem is that we promote re-use of the same component across quite a lot of sites. Now, having to overlay components does not feel like a clean/right solution to this problem.

Regards,

Peter

leeasling1Accepted solution
Level 3
June 30, 2017

I totally understand your hesitation with it, and if it was more than just overlaying the dialog I would agree it's probably not a good approach, but the view/business logic stays the same between components.  You're either going to have to maintain JavaScript to customize, or use OOTB functionality to overlay only the dialog. 

Level 3
June 30, 2017
viveksachdeva
Community Advisor
Community Advisor
August 15, 2017

You can take a look at my comment on this Re: How to add multiple rootPath in Coral 3 Pathfield