Expand my Community achievements bar.

SOLVED

"Convert to experience fragment variation" allows components that are not allowed in the experienceFragment template

Avatar

Level 1

Hi,

 

When use the option "Convert to experience fragment variation" to convert some component into experience fragment, the restrictions for allowed component is not taken into consideration.

So we are able to create experience fragment from a component that is NOT allowed on that experience fragment template. When edited that new experience fragment, the allowed components restriction works fine (only the components that are allowed are available to be dropped), even thew the not allowed component is present on the newly created experience fragment. So when used the option "Convert to experience fragment variation", any component is allowed, not respecting the allowed Components restriction. 

 

Is there a way to apply the same restriction for the allowedComponents that we have for the experience fragment template, to be applied when we convert to experience fragment from a component that is on a page?

 

Thank you in advance.

 

irena1_0-1716293339210.png

 

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi @irena1 ,

The "Convert to experience fragment variation" feature in AEM allows you to convert a component on a page to an Experience Fragment variation. However, as you mentioned, this feature does not take into account the allowed components restriction defined in the Experience Fragment template.

To enforce the allowed components restriction when converting a component to an Experience Fragment variation, you can create a custom dialog for the component that includes the allowed components restriction. The custom dialog can be used to select the allowed components that can be included in the Experience Fragment variation.

Here are the general steps to create a custom dialog for a component that enforces the allowed components restriction:

1. Define the allowed components: Define the list of allowed components that can be included in the Experience Fragment variation. This can be done using a configuration node in the repository or a custom dialog.

2. Create a custom dialog: Create a custom dialog for the component that includes the allowed components restriction. The dialog should only display the allowed components and prevent the user from selecting any other components.

3. Use the custom dialog when converting to Experience Fragment: When converting the component to an Experience Fragment variation, use the custom dialog instead of the default dialog. This will ensure that only the allowed components can be included in the Experience Fragment variation.

Note that this approach requires custom development and may not be suitable for all use cases. It's also recommended to consult with experienced AEM developers or solution architects to ensure that the custom dialog is implemented correctly and follows best practices.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi @irena1 ,

The "Convert to experience fragment variation" feature in AEM allows you to convert a component on a page to an Experience Fragment variation. However, as you mentioned, this feature does not take into account the allowed components restriction defined in the Experience Fragment template.

To enforce the allowed components restriction when converting a component to an Experience Fragment variation, you can create a custom dialog for the component that includes the allowed components restriction. The custom dialog can be used to select the allowed components that can be included in the Experience Fragment variation.

Here are the general steps to create a custom dialog for a component that enforces the allowed components restriction:

1. Define the allowed components: Define the list of allowed components that can be included in the Experience Fragment variation. This can be done using a configuration node in the repository or a custom dialog.

2. Create a custom dialog: Create a custom dialog for the component that includes the allowed components restriction. The dialog should only display the allowed components and prevent the user from selecting any other components.

3. Use the custom dialog when converting to Experience Fragment: When converting the component to an Experience Fragment variation, use the custom dialog instead of the default dialog. This will ensure that only the allowed components can be included in the Experience Fragment variation.

Note that this approach requires custom development and may not be suitable for all use cases. It's also recommended to consult with experienced AEM developers or solution architects to ensure that the custom dialog is implemented correctly and follows best practices.