Restricting a Custom Fragment Drop Zone to Accept Only Specific Fragments

I have several custom fragments that contain a button.
The button itself is a Custom Fragment so that the button’s code is maintained in a single place.
My custom fragments include a drop zone that is intended exclusively for this button fragment.

I would like to configure the drop zone so that it only accepts fragments of the “button” type,
similar to what is possible in a Master Page where you can restrict which fragments are allowed.

1 Like

Thank you for reaching out and sharing this use case! We are actively looking into ways to make Fragments more “governance-friendly.” Your feedback is timely as we evaluate how to bridge the gap between the flexibility of Fragments and the constraints of Master Pages.

To help us shape this feature, I have a quick question: How would you prefer to define these restrictions?

  1. By Fragment Category (e.g., only allow fragments from the “Buttons” category).

  2. By Specific Fragment Entry (selecting exactly which fragments are allowed via a list).

Thanks in advance!

Hi Javier_Burgueno,

Thank you for taking our requirement into account !

It is important for the solution to be as customizable as possible.
For this reason, option 2, which consists of allowing specific fragments through an allowed fragments list, would be preferable.

Our needs

As a developer, I want to centralize implementations in order to simplify maintenance and future updates.

As a content editor, I want to use predefined blocks to ensure design consistency across the website.
In the current state, Drop Zones should be avoided, because they allow users to insert any fragment.

Use case example

I have X Custom Fragments that include a button.
This button is itself implemented as a Custom Fragment (not the OOTB Button fragment).

Currently, as a developer, I have two possible approaches.

Solution 1: duplicate the button code in each fragment

In each of the X fragments, I embed the button code directly.

Drawback:
This approach is difficult to maintain. If the button code needs to be updated, I must update it in all X fragments, which increases the risk of errors or missed updates.

Solution 2: use a Drop Zone for the button

In the X fragments, I add a Drop Zone intended to host the button fragment.

Advantage:
The button code is managed in a single place. Any update to the button fragment is automatically propagated to all fragments that use it.

Drawback:
The Drop Zone allows users to add any fragment, not just the button fragment.
This creates a significant risk that other fragments could be dragged and dropped instead of the button, especially by interns or users with less experience in Liferay.

Please let us know if you need more information or additional use cases.

Jérémy