Step 1) Create a component : Disclosures
Step 2) Enable adding multiple content fragments via dialog bar of above component
Step 3) Create a content fragment as a dropdown for Editor to select multiple Disclosures to add
By implementing this the multiple items which we are adding into the content fragment model. we have to show them as below using htl
How to achieve this use case ?
Views
Replies
Total Likes
What has been tried and what is the exact issue faced? Your requirement is bit incorrect. I ll shuffle your order to implement correctly.
Create a Content fragment using this model and author the disclosure statements
Create a new cq:Component named "disclosure". The authoring dialog will take content fragment reference as input dialog
Create a sling model that ll read the authored content fragment path, and returns a List of disclosure strings
Your requirement looks very straight and easy to implement. Unless you are facing specific issues, this must be quick to implement.
Thanks for the response @sarav_prakash , this is exactly what i required, but i have one doubt in java code. At line no 11, you are trying to get disclosures element, but when you created the CF model you have mentioned the Property Name as disclosure, so my question is it should be same or different like disclosures and disclosure ?
my b. you are correct @msgavali111 keep the property name in content fragment model as `disclosures` since it is array of multiple disclosures.
Hi @msgavali111 ,
To achieve the use case of creating a component that allows adding multiple content fragments and displaying them as a dropdown, you can follow these steps:
Step 1: Create a Component - Disclosures
Step 2: Enable Adding Multiple Content Fragments via Dialog
Step 3: Create a Content Fragment as a Dropdown
Step 4: Display the Selected Disclosures as Dropdown
Here's an example of how the HTL code might look like to achieve the desired output:
<select>
<option value="">Select a Disclosure</option>
<sly data-sly-list.disclosure="${properties.disclosures}">
<option value="${disclosure.value}">${disclosure.label}</option>
</sly>
</select>
In this example, we assume that the multifield in the dialog is named "disclosures" and that each selected content fragment has a "label" field for the display label and a "value" field for the actual value.
Note that the specific implementation may vary depending on your project structure and requirements. Make sure to adjust the code according to your component's dialog field names and the structure of your content fragments.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies