Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AEM/CQ5 how to share component values?

Tags:

aem

I want to have a header component that is shared across multiple page rendering components. The header component has a text label. How do I make the value of this text label available to all page components.

Do I have to make the path in the <cq:include> to a common format?

like image 688
Viren Pushpanayagam Avatar asked Feb 03 '26 18:02

Viren Pushpanayagam


2 Answers

Design mode, if properly understood, can work quite well. However, it doesn't replicate content in the same manner as page activation, and thus can be confusing for your authors. Also, the sharing model is limited to the exact page type - which may or may not be the granularity you desire.

From CQ5's Best Practices (https://dev.day.com/docs/en/cq/current/developing/developing_guidelines_bestpractices.html), they strongly encourage the paragraph system (iparsys to inherit/share). iparsys named the same can be shared across different page templates (while design mode will only apply to a single template type).

like image 115
IT Gumby Avatar answered Feb 06 '26 11:02

IT Gumby


I can archive that by creating a design dialog that is similar to dialog (http://dev.day.com/docs/en/cq/5-6/developing/components.html#Dialogs) under the header component. You add the text label field to design dialog. And to enter value for the field, you switch the page to the design mode and click on Edit button on the top of the component. The entered value will be available to all pages that contain the header component.
Note: design dialog will be named as design_dialog

like image 27
Tuna Avatar answered Feb 06 '26 13:02

Tuna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!