0
votes

I created a component with a dialog and in the cq:action array, the last value contains static text like "componentName".

The user can click "edit" to open a dialog with a text field.

My requirement is to change the cq:action text from "componentName" to "componentName - textFieldValue".

How can I do that?

2
'My requirement is to change that cq:action text to "componentName - textFieldValue"' This isn't really clear. Can you elaborate what you mean by changing cq:action text?Imran Saeed
go to docs.adobe.com/docs/en/cq/5-5/developing/components/… .......in that article go to heading "Configuring with cq:EditConfig Properties" .....cq:actions is a string array and i want to change a property of it based on value passed by dialogtarun chine
cq:EditConfig->cq:actions value can not be access by a component dialog field value. Field values are stored as nodes under component instance on a page. cq:actions can be modified only when you defining your dialog. may I ask, what you are trying to do over here?Imran Saeed
i have a page in which i am using same component multiple time , and i am passing different values in each dialog , so by changing that text in cq:action i can differentiate those without opening the dialog for each one.... So cq:actions can not be changed dynamically ????tarun chine
cq:actions can only have certain semantics, arbitrary values won't work. You definitely cannot change them dynamically. Why don't you display the value of the fields in your dialogue when you render the component? In this way you don't have to open the dialogue every time to check the value.Imran Saeed

2 Answers

0
votes

As the comments on the question indicate this label is meant to be configured as static text for a particular component. The ExtJs class where the different actions are implemented is CQ.wcm.EditBase https://docs.adobe.com/docs/en/cq/5-6/widgets-api/index.html?class=CQ.wcm.EditBase. I don't see any accessors to interact with the actions since they are statically defined. Even for example in the CQ.wcm.EditRollover class you can get the initial config but it's read only. You can try to dig into how they are implemented, but the name wasn't intended to be dynamically displayed.

Typically you would define a new component that extends the original and just change the name. Obviously this doesn't scale well for a large set of name values.

0
votes

If your primary objective is to differentiate between multiple instances of your component based on authored values and got nothing to do with cq:actions, you can simply render the necessary values in the edit mode to be shown only while authoring.

Suppose the text field in your component has a name './text' you can do the following:

<sly data-sly-test="${wcmmode.edit}">
    ${properties.text} <!-- /* Add anything else that you want to be displayed */ -->
</sly>