Expand my Community achievements bar.

SOLVED

How do you add a second image to a proxied core image component?

Avatar

Level 2

AEM 6.5.12 & Core components 2.17.14

I need to create an image component that proxies the core component . It needs a primary and secondary image. The dialog is just two fileupload nodes. I can do it with just one image but I can't figure out how to add a second.


My first thought was to set fileNameParameter, fileReferenceParameter, & name to something like this to make it easier for the sling model to find them.

 

<primaryFile 
fileNameParameter="./primary/fileName"
fileReferenceParameter="./primary/fileReference"
name="./primary/file">

<secondaryFile
fileNameParameter="./secondary/fileName"
fileReferenceParameter="./secondary/fileReference"
name="./secondary/file">

 

Problem is I can't figure out how to point my sling model to the files. I tried this in my sling model but it didn't work.

 

@Self
@Via(type = ResourceSuperType.class)
@ValueMapValue(name="primary")
Image primaryImage;

@Self
@Via(type = ResourceSuperType.class)
@ValueMapValue(name="secondary").
Image secondaryImage;

 

What am I missing to make this work?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 6

You will not be able to this on this way because core component only works if its an image component or inherited from image component. The possible thing you can do is

1. Create new component from image component

2. Customize dialog, make a way to add multiple files.

3. Use model class to make a list of image resource with your primary image and secondary image.

4. Then on htl create a loop with your image list resource.

 

Reading your requirement this idea came to mind. This is the basic idea, when you actually implement this some things might needs to be changed.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 6

You will not be able to this on this way because core component only works if its an image component or inherited from image component. The possible thing you can do is

1. Create new component from image component

2. Customize dialog, make a way to add multiple files.

3. Use model class to make a list of image resource with your primary image and secondary image.

4. Then on htl create a loop with your image list resource.

 

Reading your requirement this idea came to mind. This is the basic idea, when you actually implement this some things might needs to be changed.