Question: IDynamicFieldContainer

Posted by Community Admin on 04-Aug-2018 22:25

Question: IDynamicFieldContainer

All Replies

Posted by Community Admin on 02-Jan-2014 00:00

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.  

 

 

Posted by Community Admin on 07-Jan-2014 00:00

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

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 17-Jan-2014 00:00

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 : IDataItemIDynamicFieldsContainer 

 

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.

 

This thread is closed