"cqDesign" variable in Expression Language(EL)

Apart from the supported variables/functions in Expression Language, we can have custom variable 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 dialog using values/properties configured in Design mode of List component(in case of 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 certain dialog field can be set based on some conditions related to design properties.
Eg : value -> ${not empty cqDesign.somecustomproperty ?  x : y}

Comments

Post a Comment

Popular posts from this blog

Embedding Third party dependency/OSGi bundle in AEM application hosted in AEMasCS

OSGI Factory Configuration implementation

Creation of Template Types for Editable templates