IContentConverter

Content converters are applied to content, media and content templates.

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 ConvertTheContent(ContentModel content)

Returns true if the content parameter should be converted by this converter, false otherwise. Typically, this will test the name or path (which represents its position in the content tree) of the content.

void ConvertContent(ContentModel content)

Performs the actual conversion of the content. Change the content parameter as required in this function.

Example

public class ExampleContentConverter : IContentConverter
{
    public string GetConverterName()
    {
        return "Example Content Converter";
    }
    
    public string GetConverterDescription()
    {
        return "This is an example content converter, it changes the name of the content.";
    }
    
    public Version GetMinumumUmbracoVersion()
    {
        return new Version(7, 0, 0);
    }
    
    public bool ConvertTheContent(ContentModel content)
    {
        return content.Name == "My Example Content";
    }
    
    public void ConvertContent(ContentModel content)
    {
        content.Name = "Renamed Example Content";
    }
}