BindingValueProvider & BindingValueProviderByContext Use these to get common data from Page property | Community
Skip to main content
Level 3
September 18, 2024
Solved

BindingValueProvider & BindingValueProviderByContext Use these to get common data from Page property

  • September 18, 2024
  • 1 reply
  • 760 views

Hi All,

 

I am trying to implement some components which reads common page property and resolve a referenced content fragment and read data from it which again is shared across many components on page. To solve this problem, I can think of below approaches.

 

If anyone has experience and have used these and also have some sample code, they can share would be great.

Thank you for your help.

 

Thanks,

Shehjad

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 abhishekanand_

Hi @shehjadk07 

 

Using BindingValueProvider or BindingValueProviderByContext is a great solution for sharing common data across components. It improves performance by avoiding redundant data fetches and simplifies the HTL code. I recommend testing it in your environment to ensure it meets your performance and maintainability standards.

 

idea behind the BindingValueProvider is to expose common data, such as page properties or content fragment data, as bindings in your HTL templates, making it globally accessible


BindingValueProvider, introduced in ACS AEM Commons, that supports providing context-aware bindings (like page context, resource context, etc.). It’s an even better fit when you need different bindings for different contexts (e.g., author vs publish environment).

1 reply

abhishekanand_
Community Advisor
abhishekanand_Community AdvisorAccepted solution
Community Advisor
September 24, 2024

Hi @shehjadk07 

 

Using BindingValueProvider or BindingValueProviderByContext is a great solution for sharing common data across components. It improves performance by avoiding redundant data fetches and simplifies the HTL code. I recommend testing it in your environment to ensure it meets your performance and maintainability standards.

 

idea behind the BindingValueProvider is to expose common data, such as page properties or content fragment data, as bindings in your HTL templates, making it globally accessible


BindingValueProvider, introduced in ACS AEM Commons, that supports providing context-aware bindings (like page context, resource context, etc.). It’s an even better fit when you need different bindings for different contexts (e.g., author vs publish environment).

Abhishek Anand
Level 3
September 26, 2024

Thank you @abhishekanand_  do you have any sample code to show the context aware binding