Expand my Community achievements bar.

SOLVED

Add Custom Button below Create Fragment Option

Avatar

Level 4

ashish_mishra1_0-1655403548290.png

I am looking for some resources, on how I can add a new button below the Content Fragment Option on /assets.html page. Once the user clicks on that button a popup should open asking for an id input, with that input I will call a servlet which will create the fragment in the backend and redirect the user to the edit screen for that content fragment.

The reason for this setup is, that we have multiple fragments, and based on the input id we want to decide which fragment model should be used, so this task we want to automate.

 

Appreciate any help regarding this.

@arunpatidar 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

You can write an event listener to move CF as soon as it is created to the new folder.

Author may confused with this but you can add instruction on create screen.

 

And make sure listener acts only act on outside certain folder.



Arun Patidar

View solution in original post

4 Replies

Avatar

Community Advisor

@ashish_mishra1 Please check for the below location for adding the button. you can overlay and then add logic to your button.

"/libs/dam/gui/content/asets/jcr:content/actions/secondary/create/items"

Avatar

Community Advisor

@ashish_mishra1 As per the reply from @Bhuwan_B you can overlay "/libs/dam/gui/content/assets/jcr:content/actions/secondary/create/items" and then add the logic.

shaileshbassi_1-1655738433466.png

But just check the granite:class which you can utilize to accommodate your business use case, otherwise there will be a lot of effort required to meet the custom business needs.

 

Just demo the feasible option and get confirmation about the best that can be achieve using the OOTB granite:class.

 

If there is any requirement for the permissions to be implemented then check with that as well, as there "granite:class" have specific "granite:renderconditions" being handled. Later on implementation of both becomes a bottleneck i.e. if you want to hide OOTB and show the custom one.

 

Thanks

Avatar

Level 4

@Shailesh_Bassi_ @Bhuwan_B 

Thanks, for the reply.

I was thinking of another solution too, as this one seems a little complex.

As per my requirement, need to create fragments in a specific folder.

For example - The author will go to  "/content/dam folder" then click on create a fragment, and then select the dynamic product modal from the list of fragment modals. 

Now post this in the title field, he will add the title as "colorful-slate-246", (alphanumeric product category code) so the task is to move this fragment automatically in the /content/dam/colorful/slate/246 folder and then create this fragment there, without asking the author to manually move there. 

kind of a weird requirement, but we are trying to segregate our product fragments based on category ids.

let me know if you guys can think of any solution here. How can we intercept the create fragment logic and add ours.

cc- @arunpatidar 

ashish_mishra1_0-1655746573218.png

 

Avatar

Correct answer by
Community Advisor

Hi,

You can write an event listener to move CF as soon as it is created to the new folder.

Author may confused with this but you can add instruction on create screen.

 

And make sure listener acts only act on outside certain folder.



Arun Patidar