U4-5286 - add property converter for color picker
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user