Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Coral Ui - Restricting the root path for assetpicker

Avatar

Level 2

How can we restrict the root path for the assetpicker (coral ui) to pick assets from a designated root path (some folder under dam) only.

Please also suggest me good sources to read concepts on coral ui.

1 Accepted Solution

Avatar

Correct answer by
Level 1

I managed to get it working with the following code.

             Granite.author.ui.assetFinder.registry.Images.searchRoot = data.restrict;

            Granite.author.ui.assetFinder.registry.Images.setSearchPath(data.restrict);

            $('foundation-autocomplete.coral-Form-field.assetfilter.path').val(data.restrict);

            Granite.author.ui.assetFinder.utilsCommons.loadAssets(false);

View solution in original post

5 Replies

Avatar

Employee

Which AEM version are you using? Also are you taking about http://localhost:4502/aem/assetpicker.html  ?

Avatar

Level 2

I am using AEM 6.3, yes correct it is the same component that i have implemented using coral ui in render.jsp.

Avatar

Level 1

Is there any answer to this ?

In 6.2 I had a clientlib that did

            Granite.author.ui.assetFinder.registry.Images.searchRoot = data.restrict;

            Granite.author.ui.assetFinder.registry.Images.setSearchPath(data.restrict);

            $('.coral-InputGroup-input.coral-Textfield.js-coral-pathbrowser-input[name=assetfilter_image_path]').val(data.restrict);

            Granite.author.ui.assetFinder.utilsCommons.loadAssets(false);

where data.restrict is the path i want to set the filter to

This doesn't work in 6.3, even though i can see the page code is calling the loadAssets(false) it isn't updating the images

Avatar

Correct answer by
Level 1

I managed to get it working with the following code.

             Granite.author.ui.assetFinder.registry.Images.searchRoot = data.restrict;

            Granite.author.ui.assetFinder.registry.Images.setSearchPath(data.restrict);

            $('foundation-autocomplete.coral-Form-field.assetfilter.path').val(data.restrict);

            Granite.author.ui.assetFinder.utilsCommons.loadAssets(false);