Change rootPath of the pathbrowser depending on the context where the component is added | Community
Skip to main content
Peter_Puzanovs
New Participant
Jun 30, 2017 10:00 AM UTC
Solved

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

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.
leeasling1Accepted solution
Level 3
Jun 30, 2017 2:14 PM UTC

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

viveksachdeva
New Participant
Aug 15, 2017 9:30 AM UTC

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

Translate
Level 3
Jun 30, 2017 2:33 PM UTC
leeasling1Accepted solution
Level 3
Jun 30, 2017 2:14 PM UTC

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. 

Translate
Peter_Puzanovs
New Participant
Jun 30, 2017 2:11 PM UTC

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

Translate
Level 3
Jun 30, 2017 1:59 PM UTC

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.

Translate
Peter_Puzanovs
New Participant
Jun 30, 2017 12:08 PM UTC

Good question, sorry should have mentioned it before,

Touch UI AEM 6.3

Translate
Nupur_Jain
Employee
Jun 30, 2017 10:49 AM UTC

Hi,

Is it Touch UI dialog or classic UI?

Translate