Hello everyone,
I am trying to incorporate the editorial Image component inside mine (advancedbanner), but I cannot seem to make it work.
I want to be able to configure the image component from inside the dialog of the advanced banner without initiating a new component outside of the content tree.
I need the image component so that the src url is dynamic and it's not a static url that is coming from the DAM (which makes the image file size very big).
This is what I've done so far:
Inside advancedbanner.html I have this:
Solved! Go to Solution.
Views
Replies
Total Likes
Did you try referring to the core components teaser component? It has image inside it.
Did you try referring to the core components teaser component? It has image inside it.
If you want to use AEM core Image Component functionalities without having the component as nested component, you can get the current resource in Sling Model and adapt the resource to Core Image component and then create a getter of the Image Model in your custom sling model.
After this, instead of calling the image component in HTL, you can use your custom html of image and then use the required variables from Image Model.
Example: Use this in your custom sling model.
private Image image;
@PostConstruct
public void init() {
image = resource.adaptTo(Image.class);
image.getSrc(); //This should have the same path as present in the image component
}
public Image getImage() {
return image;
}
@AnastasiosGi Did you find the suggestions helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies