How to add a field to a ContentType programmatically in data migration?

Topics: Customizing Orchard, Writing modules
Nov 27, 2012 at 9:10 AM

Hi everyone,

I'm trying to add a field to contentType in data migration but can't find a way to do so. I can add a field to ContentPart programmatically in data migration but not to ContentType.  How to add a field to a ContentType programmatically in data migration?

Thank you,
muges

Coordinator
Nov 27, 2012 at 5:23 PM

Fields are always added to parts, never to types. What is usually done (including by the admin ui) is to add them to a part that has the same name as the content type.

Dec 6, 2012 at 8:07 PM

Thank you for the explaination bertrandleroy. Thats make sense now. I'll try to add the part and type with the same name in data migration.

Regards,
muges