How to make fieldcollection be added by default on object edit?

I want to add a set of fields to several objects.

If I use Fieldcollection, I must press green “plus” to add it when I create a new object.

Is there any way to make it being added by default?

Or any other workaround to be able to add a set of fields to several classes. So I can change something in the set in one place, not per-Class.

Thanks.

Hi,
you could create an event listener and add the field collection via code every time an object is created.

BR
Christian

1 Like

@fash
Cool!

I know how to catch the moment in the event listener.
But please, point to some example how to add a field collection programmatically.

Thanks!

@gruz https://pimcore.com/docs/6.x/Development_Documentation/Objects/Object_Classes/Data_Types/Fieldcollections.html#page_Working-with-PHP-API