Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

restricting cq:dialog options on included child components

tims19814439
Level 2
Level 2

I have a composite component consisting of three included components an image a title and a text component. Normally since the title component inherits the `wcm/foundation/components/title` the data-sly-resource included component gets the title type option (h1,h2...) from it's parent. However for this specific composite component I want to limit the type option to just have h2 available. The Title component is included in the composite component like this:

<div data-sly-unwrap="${!wcmmode.edit}" data-sly-resource="${'title' @ resourceType='project/components/generic/title'}"></div>

This allows the content editor to edit the title in place.

My question is if it would be possible in some way to place cq:dialog restrictions on the title component that is included from the composite component to just allow the content editor to select h2?

1 Accepted Solution
Ratna_Kumar
Correct answer by
Community Advisor
Community Advisor

Hi,

Yes ,we do the same approach as Scott suggested.

First copy the JCR Dialog from the title component to your new component and modify according as per your requirement.

Hope this helps!!

Thanks,

Ratna Kumar.

View solution in original post

7 Replies
Lokesh_Shivalingaiah
Community Advisor
Community Advisor

Hi,

If you need any variation to the existing component, you can overlay that component and create a new one and then use it.

else you may have to write some listeners to handle these restrictions at different places which personally I don’t prefer as it increases the complexity of  a component and also it’s maintenance.

thanks

tims19814439
Level 2
Level 2

this would also mean that I have multiple title components which do nothing but restrict the cq dialog options and would in my opinion also create complexity

smacdonald2008
Level 10
Level 10

I also prefer the 1-1 approach. Each  component has its own JCR branch that defines a dialog. This makes it easy to control which fields are used in a component dialog. As Lokesh mentions - if you want to do more complex stuff - you can write event listeners, etc.

Nirmal_Jose
Community Advisor
Community Advisor

In my usecase, since H1-H5 styles are managed in styleguide, we use Generic Lists from ACS common to manage these lists. We created various variations based on the component context definitions (hero components title -> h1- h5, banner components  - h2->h5 etc)

tims19814439
Level 2
Level 2

when you say 1 on 1 approach how would you suggest doing this efficiently with as little duplication as possible ? for this instance with a title component

smacdonald2008
Level 10
Level 10

Copy the JCR Dialog from the the title component to your new component. Then make the modifications under your new component's dialog JCR nodes. That is the best way in my view. It works and cuts down on complexity.

Ratna_Kumar
Correct answer by
Community Advisor
Community Advisor

Hi,

Yes ,we do the same approach as Scott suggested.

First copy the JCR Dialog from the title component to your new component and modify according as per your requirement.

Hope this helps!!

Thanks,

Ratna Kumar.

View solution in original post