We have many components using granite/ui/components/coral/foundation/form/pathfield, and I want to add a button to this pathfield. I found the code for the existing button is in /libs/granite/ui/components/coral/foundation/clientlibs/foundation/js/autocomplete/autocomplete.js
I could create an overlay and add the button in this file, but it seems like overkill for a few lines of code (autocomplete.js is around 1000 lines). Is there a better way to do this?
Solved! Go to Solution.
Views
Replies
Total Likes
No, you are NOT duplicating by overlaying. Instead running an additional new clientlib on top of existing ootb autocomplete.js. So browser first runs autocomplete.js and then runs your custom override clientlib. This ll apply to ALL components, wouldn't require additional changes to individual component.
Sreekanth from the https://experience-aem.blogspot.com/ provides an excellent compilation of many similar customizations.
Magic starts from
$document.on('dialog-ready', handlePathField);
And on the handlePathField callback, you force your customizations. Start with a simple console.log inside the callback to understand when this clientlib is invoked. And you can add more customizations over.
Views
Replies
Total Likes
No overlays are only for component nodes, not for clientlibs. Instead you create a new clientlib with categories granite.ui.coral.foundation and authoring. Follow this blog as example and implement your clientlib js accordingly
Views
Replies
Total Likes
I have a question regarding this. If I follow this method, wouldn't I need to change every component that uses granite/ui/components/coral/foundation/form/pathfield to use the custom pathfield instead?
I am hesitant against this is because it would require updating thousands of our components.
Views
Replies
Total Likes
No, you are NOT duplicating by overlaying. Instead running an additional new clientlib on top of existing ootb autocomplete.js. So browser first runs autocomplete.js and then runs your custom override clientlib. This ll apply to ALL components, wouldn't require additional changes to individual component.
Sreekanth from the https://experience-aem.blogspot.com/ provides an excellent compilation of many similar customizations.
Magic starts from
$document.on('dialog-ready', handlePathField);
And on the handlePathField callback, you force your customizations. Start with a simple console.log inside the callback to understand when this clientlib is invoked. And you can add more customizations over.
Views
Replies
Total Likes
Thank you so much, that helps a lot!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies