Skip to content

Instantly share code, notes, and snippets.

@leekelleher
Created March 28, 2018 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leekelleher/7f0a83577985e67185e7086cafc29ad0 to your computer and use it in GitHub Desktop.
Save leekelleher/7f0a83577985e67185e7086cafc29ad0 to your computer and use it in GitHub Desktop.
Umbraco Forms - Value Converter for the "Form Picker" property-editor, used to define the value type as a `Guid`
using System;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
namespace Our.Umbraco.Web.PropertyEditors
{
public class UmbracoFormsPickerValueConverter : PropertyValueConverterBase, IPropertyValueConverterMeta
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.PropertyEditorAlias.Equals("UmbracoForms.FormPicker");
}
public PropertyCacheLevel GetPropertyCacheLevel(PublishedPropertyType propertyType, PropertyCacheValue cacheValue)
{
return PropertyCacheLevel.Content;
}
public Type GetPropertyValueType(PublishedPropertyType propertyType)
{
return typeof(Guid);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment