How to make core component (download component v2) to show/hide "file size" property with a checkbox reference | Community
Skip to main content
Level 2
January 9, 2023
Solved

How to make core component (download component v2) to show/hide "file size" property with a checkbox reference

  • January 9, 2023
  • 1 reply
  • 498 views

I am working with one of the core component (download component v2).

 

When I author the dialog with any file, it shows file name, file size along with download option.

 

My requirement is that, I have added a checkbox under properties tab under download component.

 

When checkbox is selected while authoring, only then the file size property should show up, and if checkbox is not selected, it should not show file size info for download component.

 

I have added checkbox under properties tab of download component and wrote a slingmodel to get the checkbox node property to sling model.

 

Can someone let me know how can I get the desired result as mentioned above from here Please? Also help me with code to accomplish this requirement? Thanks in advance!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Kiran_Vedantam

Hi @srk381 

 

There is a getFileSize method in components: https://github.com/adobe/aem-core-wcm-components/blob/525cbab6e5a1bd5a8628da7217328fd80016a5c1/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v1/DownloadImpl.java#L65. Simply you can delegate your model and show and hide the value it is returning on your custom method.

 

Delegating: https://kiransg.com/2021/11/07/aem-core-component-delegation/

 

1 reply

Kiran_Vedantam
Community Advisor
Kiran_VedantamCommunity AdvisorAccepted solution
Community Advisor
January 9, 2023

Hi @srk381 

 

There is a getFileSize method in components: https://github.com/adobe/aem-core-wcm-components/blob/525cbab6e5a1bd5a8628da7217328fd80016a5c1/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v1/DownloadImpl.java#L65. Simply you can delegate your model and show and hide the value it is returning on your custom method.

 

Delegating: https://kiransg.com/2021/11/07/aem-core-component-delegation/