April 2, 2020
Estimated Post Reading Time ~

Tips on: Component Creation in CQ5

Tip 1:
One of the things you really need to remember when developing a custom CQ5 component is that regardless of what it is, what it does, or what it smells like, it must have a child dialog component for it to be available in the sidekick for Authors to use. Even if it does not need a dialog to accept any user input, without the dialog the component can never be chosen from the sidekick. So if you’ve created a component and cannot find it in the sidekick, this may be the reason why.

Moral of the story: One Dialog to rule them all…
Tip 2:
Hit another gotchya today when creating a custom CQ5 component. The component itself is very simple – a piece of text that opens a dialog when edited / double-clicked. The dialog has 5 fields – 3 simple text fields, one checkbox, and one multi value field. Simple enough.

But after adding the component to a page for testing, the dialog was never appearing. No amount of righ-click -> Edit or furious double-clicking would bring the dialog up. A tail of the error.log revealed absolutely nothing at all.

What it turned out to be was an incorrect xtype on one of the widgets. I used an ‘arraystore’, which I thought I’d used in the past for a multiple value field with no problem. Only after deleting widgets one by one and trying to open the dialog did I work out that this was the culprit. After looking further down the CQ5 xtypes page, I saw the ‘multifield’ xtype. After creating the widget again with the new xtype, the component dialog opened as expected.

Moral of the story: If one of your components is not displaying when expected, check your xtypes!!


By aem4beginner

No comments:

Post a Comment

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