Question: IDynamicFieldContainer
Does anyone know the interfaces that need to be implemented by a custom type in order to enable custom field support in sitefinity?
My custom type is currently implementing IContent, IDynamicFieldContainer and is editiable in the UI however Sitefinity does not enable support for custom fields. I think I am missing an interface or perhaps a setting on the module configuration.
The type is hosted in a native custom module (via thunder) not a dynamic module (via module builder)
I am hoping someone has previously run into this issue and point me in the right direction.
Hello,
Please refer to our official documentation for creating custom fields programaticaly:
http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/modules/ecommerce/product-types/custom-fields/creating-custom-fields
If you are adding these fields for a custom module I would suggest you to review these forum threads:
http://www.sitefinity.com/developer-network/forums/sitefinity-sdk/adding-custom-fields-option-to-custom-modules
Regards,
Stefani Tacheva
Telerik
In order for a custom content type to implement IDynamicFieldContainer the following steps need to be performed:
1 - Your custom content type class must inherit the IDynamicFieldContainer marker interface
2 - Your custom content type must be marked with the TypeDescriptionProvider attribute with typeof(DynamicFieldsTypeDescriptionProvider) as its first argument
[TypeDescriptionProvider(typeof(DynamicFieldsTypeDescriptionProvider))] public class MyCustomContentType : IDataItem, IDynamicFieldsContainer
3 - You must override the SupportDynamicTypes property in your MetadataSource and return true
public class MyContentTypeMetadataSource : SitefinityMetadataSourceBase protected override bool SupportDynamicTypes get return true; // other code removed for brevity
4 - Use the MetadataManager.CreateMetaType() method to register the type
5 - Use the App.WorkWith().DynamicData() Façade to create your custom fields definition.
Note: Please note that the assembly version for your assembly is used to determine if the metadata schema update needs to be performed.