Try our conversational search powered by Generative AI!

Interface IInitializableContent

Interface that can be implemented by IContentData instances that want to be called during initialization of new instances.

Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public interface IInitializableContent

Methods

SetDefaultValues(ContentType)

Sets the default property values on the content data instance.

Declaration
void SetDefaultValues(ContentType contentType)
Parameters
Type Name Description
ContentType contentType

Type of the content.

Examples
[ContentType(DisplayName = "Article Page")]
public class Article : PageData
{
public virtual string Heading { get; set; }
public virtual XhtmlString MainBody { get; set; }

public override void SetDefaultValues(ContentType pageType)
{
    base.SetDefaultValues(pageType);

    Heading = "My awesome article";
    MainBody = new XhtmlString("<p>Enter your article text here<p/>");
}
}

Extension Methods