U4-5286 - add property converter for color picker

This commit is contained in:
Stephan
2014-07-29 09:52:00 +02:00
parent c2816e759b
commit 53ea491bd6
2 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Core.PropertyEditors.ValueConverters
{
public class ColorPickerValueConverter : PropertyValueConverterBase
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.PropertyEditorAlias.InvariantEquals(Constants.PropertyEditors.ColorPickerAlias);
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
// make sure it's a string
return source.ToString();
}
}
}

View File

@@ -419,6 +419,7 @@
<Compile Include="PropertyEditors\SupportTagsAttribute.cs" />
<Compile Include="PropertyEditors\TagPropertyDefinition.cs" />
<Compile Include="PropertyEditors\TagValueType.cs" />
<Compile Include="PropertyEditors\ValueConverters\ColorPickerValueConverter.cs" />
<Compile Include="PropertyEditors\ValueConverters\IntegerValueConverter.cs" />
<Compile Include="PropertyEditors\IPropertyValueConverterMeta.cs" />
<Compile Include="PropertyEditors\ValueConverters\JsonValueConverter.cs" />