January 2, 2021
Estimated Post Reading Time ~

"cqDesign" variable in Expression Language

Apart from the supported variables/functions in Expression Language, we can have custom variables created with help of ExpressionCustomizer(com.adobe.granite.ui.components.ExpressionCustomizer) and the same can be made use of in Expression Language.
One such variable is cqDesign used to fetch design properties as we do with currentStyle.

Implementation Details:
Design design = getDesign();
ExpressionCustomizer customizer = ExpressionCustomizer.from(request);
customizer.setVariable("cqDesign", design);

Usage in granite:hide:
  • granite:hide property with cqDesign variable in EL has been used widely in Core Components.
  • Illustration of Core List component related to this with screenshots has been mentioned in helpx link
  • It controls the list displaying options of a dialog using values/properties configured in Design mode of List component(in case of the static template) or via Policy of List component (in case of Editable template)
  • Given that "cqDesign" is associated with Design, we can write our own custom conditions related to design to control our resources from being displayed.
Usage in setting value for dialog field:
Let's say, the value property of a certain dialog fields can be set based on some conditions related to design properties.
Eg: value -> ${not empty cqDesign.somecustomproperty ? x : y}


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.