Thursday, December 6, 2018

"note" resourceType in AEM Dialogs

Hello Everyone,

Today In this quick blog I am writing about “note” resourceType in a dialog that can be a life
saver. I was amazed why i haven’t know about it and used  it before.

Problem Statement:In AEM, we always try to make dialogs user friendly as much as we can and sometimes we give instructions to authors by giving fieldDescription corresponding to every field. But the problem with fieldDescription is author always need to hover on tooltip to read the instruction.

I was always looking for something better so that author can directly open the dialog
and can see what he/she supposed to enter in the fields.

So Here, a note resourceType came for rescue.This resourceType is available
here: /libs/cq/gui/components/authoring/dialog/note

How to use this:

Make a node with these below properties:
jcr:primaryType : nt:unstructured
sling:resourceType:cq/gui/components/authoring/dialog/note
note: “Any note for Authors”
That's all you need to do.
Dialog After Adding note resourceType

Extended Problem Solving: But i was trying to make an additional thing with this note.I want to provide a hyperlink in the dialog also.So this is also very easy to do. You can overlay or override this note resourceType and change the note.jsp line number 32 .

<h4 class="coral-Heading coral-Heading--4"><%=outVar(xssAPI, i18n, note) %></h4>
to
<h4 class="coral-Heading coral-Heading--4"><%=note %></h4>

After that you can add hyperlinks also in the dialogs by writing html also.
Demonstartion Video on "note" resourceType in AEM Dialogs:

If you have any query or suggestion then kindly comment or mail us at sgaem.blog02@gmail.com

Hope it will help you guys !!
Thanks and Happy Learning.

2 comments: