IDocumentTypeConverter

Document type converters are applied to document types and media types. They can be used to update both the document/media type and the document/media.

Methods

String GetConverterName()

Returns the name of the converter. This is shown in the Settings section of Converge for the switch for this converter.

String GetConverterDescription()

Returns the description of the converter. This is shown in the Settings section of Converge for the switch for this converter.

Version GetMinumumUmbracoVersion()

If you are unsure about how to implement this method, then simply return version 7.0.0 and the converter will always be applied.

Returns the first Umbraco version that this converter should be applied to. The converter switch will not be shown in the Settings section and the converter will not be applied to versions of Umbraco prior to the value returned by this method. The converter will be applied to all versions on or after this value.

Applies to the "local" site Umbraco version, that is the site that will be updated.

Boolean ConvertDocumentTypeWithAlias(String contentTypeAlias)

Return true if the parameter is the alias of a document type that should be converted by this converter, false otherwise. Note, this test is applied to both the document type and content to see if it should be updated by this class.

void ConvertDocumentType(ContentTypeModel contentType)

Performs the actual conversion of the document type. Change the contentType parameter as required in this function.

void ConvertContent(ContentModel content)

Convert any content that uses the document type. Change the content parameter as required in this function.

Example

public class ExampleDocumentTypeConverter : IDocumentTypeConverter
{
    public string GetConverterName()
    {
        return "Example Document Type Converter";
    }
    
    public string GetConverterDescription()
    {
        return "This is an example of a document type converter. It updates the document type and content names.";
    }
    
    public Version GetMinumumUmbracoVersion()
    {
        return new Version(7, 0, 0);
    }
    
    public bool ConvertDocumentTypeWithAlias(string contentTypeAlias)
    {
        return contentTypeAlias == "MyDocumentType";
    }
    
    public void ConvertDocumentType(ContentTypeModel contentType)
    {
	    contentType.Name += " - Updated";
    }
    
    public void ConvertContent(ContentModel content)
    {
	    content.Name += " - Updated";
    }
}