Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Adding default component to carousel component

Avatar

Level 4

Hello ,

 

I am using /apps/core/wcm/components/carousel as reference ,
 
 
1> I want to build carousel component that when we drag and drop the component, it must have the initial set up of image and text component added by default  inside the parays
 
 image componet is located at /apps/project/components/image and 
 text component is located at /apps/project/components/text
 
 I can see the below code  in  /apps/core/wcm/components/carousel/v1/carousel/carousel.html
 
  <sly data-sly-resource="${resource.path @ resourceType='wcm/foundation/components/parsys/newpar', appendPath='/*', decorationTagName='div', cssClassName='new section aem-Grid-newComponent'}"
         data-sly-test="${(wcmmode.edit || wcmmode.preview) && carousel.items.size < 1}"></sly>
 
 
2> Using the dialog under items when i add again  I should be again added by image and text component to the next item using parasys . 
 
 
Srinivas_Opti_0-1726124414266.png

 

 

 Please let me know how this can be achieved

 
 
Regards,
Srinivas
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Srinivas_Opti 

  1. Create a custom component as a container component(e.g. text-and-image) which contains Text and Image component.
  2. Add text-and-image component in the cq:template node of Carousel component as initial content. Tab Example
  3. Allow only text-and-image component in the parsys of Carousel component, so when you try to add one more slide, you would have option to only add text-and-image component

CAUTION: DO NOT USE CORE COMPONENT DIRECTLY, USE PROXY PATTERN



Arun Patidar

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @Srinivas_Opti 

  1. Create a custom component as a container component(e.g. text-and-image) which contains Text and Image component.
  2. Add text-and-image component in the cq:template node of Carousel component as initial content. Tab Example
  3. Allow only text-and-image component in the parsys of Carousel component, so when you try to add one more slide, you would have option to only add text-and-image component

CAUTION: DO NOT USE CORE COMPONENT DIRECTLY, USE PROXY PATTERN



Arun Patidar