Added member group picker value converter

This commit is contained in:
James Coxhead
2016-11-02 21:26:41 +00:00
parent a10214d82b
commit db02c3b73c
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
using System;
using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Core.PropertyEditors.ValueConverters
{
public class MemberGroupPickerValueConverter : PropertyValueConverterBase, IPropertyValueConverterMeta
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.PropertyEditorAlias.InvariantEquals(Constants.PropertyEditors.MemberGroupPickerAlias);
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
return source == null ? string.Empty : source.ToString();
}
public Type GetPropertyValueType(PublishedPropertyType propertyType)
{
return typeof(string);
}
public PropertyCacheLevel GetPropertyCacheLevel(PublishedPropertyType propertyType,
PropertyCacheValue cacheValue)
{
return PropertyCacheLevel.Content;
}
}
}

View File

@@ -507,6 +507,7 @@
<Compile Include="PropertyEditors\ValueConverters\DecimalValueConverter.cs" />
<Compile Include="PropertyEditors\ValueConverters\LabelValueConverter.cs" />
<Compile Include="PropertyEditors\ValueConverters\ImageCropperValueConverter.cs" />
<Compile Include="PropertyEditors\ValueConverters\MemberGroupPickerValueConverter.cs" />
<Compile Include="PublishedContentTypeConverter.cs" />
<Compile Include="Publishing\UnPublishedStatusType.cs" />
<Compile Include="Publishing\UnPublishStatus.cs" />