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
    6 days ago
    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
    5 days ago
    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";
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft