Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,36 @@
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Umbraco.Core;
using Umbraco.Web;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Logging;
using TableEditor.Models;
using TableEditor.Extensions;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Composing;

namespace TableEditor.PropertyConverter
{
[PropertyValueType(typeof(TableEditorModel))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class TableEditorValueConverter : PropertyValueConverterBase
{
public override bool IsConverter(PublishedPropertyType propertyType)

public override bool IsConverter(IPublishedPropertyType propertyType)
{
return propertyType.EditorAlias.Equals("Imulus.TableEditor");
}

public override PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType)
{
return PropertyCacheLevel.Element;
}

public override Type GetPropertyValueType(IPublishedPropertyType propertyType)
{
return propertyType.PropertyEditorAlias.Equals("Imulus.TableEditor");
return typeof(TableEditorModel);
}

public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
public override object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType,
object source, bool preview)
{

if (source == null)
{
return new TableEditorModel();
Expand All @@ -42,12 +51,13 @@ public override object ConvertDataToSource(PublishedPropertyType propertyType, o
}
catch (Exception ex)
{
LogHelper.Error<TableEditorModel>(ex.Message, ex);
Current.Logger.Error( typeof(TableEditorModel),ex, ex.Message + "{1}", source.ToString());
return new TableEditorModel();
}
}

return sourceString;
}

}
}
Loading