1. Overlay the Dialog
Copy the Experience Fragment V2 component from /apps/core
to your project’s /apps/your-project/components/experiencefragment
path:
/apps/core/components/experiencefragment/v2/experiencefragment
→
/apps/your-project/components/experiencefragment
Make sure you're copying the cq:dialog
node from the experiencefragment
component.
2. Modify the Dialog
In the cq:dialog
XML (or .content.xml
) file, locate the "Experience Fragment Options" tab. This typically uses a granite:Form
with tabs and fields inside.
Add two new fields under the correct tab:
<id
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Id"
name="./id" />
<audience
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Audience"
name="./audience" />
Place these within the correct tab content node (likely named something like experienceFragmentOptions
).
3. Save the Fields in the JCR
Ensure the name="./id"
and name="./audience"
attributes are used so values are persisted in the JCR under the component's content node.
4. Read the Values in the HTL or Java Model (Optional)
If you're rendering or using these fields on the frontend or backend, make sure to include them in the model:
@ValueMapValue
private String id;
@ValueMapValue
private String audience;
And expose them via getter methods in your model.