Search Results for

    Show / Hide Table of Contents
    View Source

    Class ImageCropperPropertyEditor

    Represents an image cropper property editor.

    Inheritance
    object
    DataEditor
    Namespace: Umbraco.Cms.Core.PropertyEditors
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    [DataEditor("Umbraco.ImageCropper", ValueType = "JSON", ValueEditorIsReusable = true)]
    public class ImageCropperPropertyEditor : DataEditor, IDataEditor, IDiscoverable, IMediaUrlGenerator, IValueSchemaProvider, INotificationHandler<ContentCopiedNotification>, INotificationHandler<ContentDeletedNotification>, INotificationHandler<MediaDeletedNotification>, INotificationHandler<MediaSavingNotification>, INotificationHandler<MediaMovedToRecycleBinNotification>, INotificationHandler<MediaMovedNotification>, INotificationHandler<MemberDeletedNotification>, INotificationHandler

    Constructors

    View Source

    ImageCropperPropertyEditor(IDataValueEditorFactory, ILoggerFactory, MediaFileManager, IOptionsMonitor<ContentSettings>, IIOHelper, UploadAutoFillProperties, IContentService, IJsonSerializer)

    Initializes a new instance of the ImageCropperPropertyEditor class.

    Declaration
    public ImageCropperPropertyEditor(IDataValueEditorFactory dataValueEditorFactory, ILoggerFactory loggerFactory, MediaFileManager mediaFileManager, IOptionsMonitor<ContentSettings> contentSettings, IIOHelper ioHelper, UploadAutoFillProperties uploadAutoFillProperties, IContentService contentService, IJsonSerializer jsonSerializer)
    Parameters
    Type Name Description
    IDataValueEditorFactory dataValueEditorFactory

    Factory for creating data value editors for property values.

    ILoggerFactory loggerFactory

    Factory used to create logger instances for logging operations.

    MediaFileManager mediaFileManager

    Manages media file storage and retrieval.

    IOptionsMonitor<ContentSettings> contentSettings

    Provides access to content-related configuration settings.

    IIOHelper ioHelper

    Helper for IO operations such as path resolution and file handling.

    UploadAutoFillProperties uploadAutoFillProperties

    Configuration for auto-filling properties on file upload.

    IContentService contentService

    Service for managing and accessing content items.

    IJsonSerializer jsonSerializer

    Serializer for handling JSON serialization and deserialization.

    Properties

    View Source

    PropertyIndexValueFactory

    Gets the IPropertyIndexValueFactory instance used by the image cropper property editor to provide index values for properties. For this editor, a NoopPropertyIndexValueFactory is used, meaning no index values are generated.

    Declaration
    public override IPropertyIndexValueFactory PropertyIndexValueFactory { get; }
    Property Value
    Type Description
    IPropertyIndexValueFactory

    Methods

    View Source

    CreateConfigurationEditor()

    Creates the corresponding preValue editor.

    Declaration
    protected override IConfigurationEditor CreateConfigurationEditor()
    Returns
    Type Description
    IConfigurationEditor

    The corresponding preValue editor.

    View Source

    CreateValueEditor()

    Creates the corresponding property value editor.

    Declaration
    protected override IDataValueEditor CreateValueEditor()
    Returns
    Type Description
    IDataValueEditor

    The corresponding property value editor.

    View Source

    GetValueSchema(object?)

    Gets a JSON Schema (draft 2020-12) describing the incoming value structure.

    Declaration
    public JsonObject? GetValueSchema(object? configuration)
    Parameters
    Type Name Description
    object configuration

    The data type configuration, which may affect the schema.

    Returns
    Type Description
    JsonObject

    A System.Text.Json.Nodes.JsonObject containing a valid JSON Schema, or null if the schema cannot be generated for the given configuration.

    Remarks

    The returned schema should describe the structure that IDataValueEditor.FromEditor receives (i.e., what the Management API accepts).

    For configuration-dependent schemas (e.g., BlockList with specific element types), the schema should reflect the constraints defined in the configuration.

    View Source

    GetValueType(object?)

    Gets the CLR type that represents the incoming value structure.

    Declaration
    public Type? GetValueType(object? configuration)
    Parameters
    Type Name Description
    object configuration

    The data type configuration, which may affect the value type.

    Returns
    Type Description
    Type

    The CLR type of the incoming value, or null if the type cannot be determined or varies significantly based on configuration.

    Remarks

    For simple editors (e.g., textbox), this might return string. For complex editors (e.g., MediaPicker3), this returns the DTO type that the editor submits. For block-based editors where the structure is entirely configuration-dependent, this may return null.

    View Source

    Handle(ContentCopiedNotification)

    Handles the copying of uploaded image files for image cropper properties after content has been copied.

    Declaration
    public void Handle(ContentCopiedNotification notification)
    Parameters
    Type Name Description
    ContentCopiedNotification notification

    The notification containing the original content and its copy.

    View Source

    Handle(ContentDeletedNotification)

    Handles a notification.

    Declaration
    public void Handle(ContentDeletedNotification notification)
    Parameters
    Type Name Description
    ContentDeletedNotification notification

    The notification.

    View Source

    Handle(MediaDeletedNotification)

    Handles a notification.

    Declaration
    public void Handle(MediaDeletedNotification notification)
    Parameters
    Type Name Description
    MediaDeletedNotification notification

    The notification.

    View Source

    Handle(MediaMovedNotification)

    Handles a notification.

    Declaration
    public void Handle(MediaMovedNotification notification)
    Parameters
    Type Name Description
    MediaMovedNotification notification

    The notification.

    View Source

    Handle(MediaMovedToRecycleBinNotification)

    Handles a notification.

    Declaration
    public void Handle(MediaMovedToRecycleBinNotification notification)
    Parameters
    Type Name Description
    MediaMovedToRecycleBinNotification notification

    The notification.

    View Source

    Handle(MediaSavingNotification)

    Handles a notification.

    Declaration
    public void Handle(MediaSavingNotification notification)
    Parameters
    Type Name Description
    MediaSavingNotification notification

    The notification.

    View Source

    Handle(MemberDeletedNotification)

    Handles a notification.

    Declaration
    public void Handle(MemberDeletedNotification notification)
    Parameters
    Type Name Description
    MemberDeletedNotification notification

    The notification.

    View Source

    TryGetMediaPath(string?, object?, out string?)

    Attempts to extract the media path from the provided value if the property editor alias matches this editor.

    Declaration
    public bool TryGetMediaPath(string? propertyEditorAlias, object? value, out string? mediaPath)
    Parameters
    Type Name Description
    string propertyEditorAlias

    The alias of the property editor to compare with this editor's alias.

    object value

    The property value from which to attempt to extract the media path.

    string mediaPath

    When this method returns, contains the extracted media path if successful; otherwise, null.

    Returns
    Type Description
    bool

    true if a valid media path was extracted; otherwise, false.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX