Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • InvalidHandle 3 posts 93 karma points
    May 16, 2018 @ 15:25
    InvalidHandle
    0

    Use existing value converter with custom property editor ?

    I made a custom property editor that returns crop data in JSON format, exactly like the image cropper does. I read about value converters but can't figure out how exactly I can tell Umbraco to return the data in the form of ImageCropDataSet, like the imagecropper does. (So I can use the property in razor as if it was an image cropper, Model.croppedImage.Src for example)

    I tried going through the code to see how Umbraco does this, but I can't apply this to my custom property editor.

    Thanks in advance !

  • InvalidHandle 3 posts 93 karma points
    May 17, 2018 @ 13:00
    InvalidHandle
    100

    I figured it out, I made a class that inherited from the ImageCropperValueConverter and made some changes

    [PropertyValueType(typeof(ImageCropDataSet))]
    public class CustomImageCropper : ImageCropperValueConverter
    {
        public override bool IsConverter(PublishedPropertyType propertyType)
        {
            return propertyType.PropertyEditorAlias == "CustomImageCropper";
        }
    }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies