Duplicity restriction for component availability

Within an area in Magnolia template, we could create 2 components. We should restrict the user in a way that they don't create duplicate components. Can we achieve this through configurations or this requires a custom property created? Any pointers would be of great help!

areas: myArea: availableComponents: maxComponents: 2 renderType: freemarker type: list Component1: id: Component2: id:

When we have created content with component1 then it shouldn't be available for selection later.

1 answer

  • answered 2019-09-10 08:04 Jan

    You have already limited number of components to 2. What you can do extra is to autogenerate each of the components at area creation time and mark them as not delete-able so that editors can't remove them and can't add more of the same (due to maxComponents restriction either). This effectively limits everyone to use of max 1 component of given type, but also forces exactly 1 component of given type.
    If you want anything more sophisticated, you need to code it yourself.