May 27, 2020
Estimated Post Reading Time ~

How To Set Dynamic Value For Component Edit Bar Label

Sample code in JSP
you can set the label value of the component edit bar dynamically.

editContext is implicit object of com.day.cq.wcm.api.components.EditContext interface

editContext.getEditConfig().getToolbar().add(0, new Toolbar.Label("sample"));

By Using cq:EditConfig
Add the below configurations under your component's "cq:EditConfig" node

<cq:actionConfigs jcr:primaryType="nt:unstructured">
<separator
jcr:primaryType="nt:unstructured"
xtype="tbseparator"/>
<manage
jcr:primaryType="nt:unstructured"
handler="function(){&#xa;&#x9;window.open(CQ.WCM.getPagePath()+&quot;.openNewPage.html&quot;, '_blank');&#xa;}"
text="Edit on Other Page"/>
</cq:actionConfigs>


By aem4beginner

No comments:

Post a Comment

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