Class ImageCropperPropertyEditor
Represents an image cropper property editor.
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 SourceImageCropperPropertyEditor(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 SourcePropertyIndexValueFactory
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 SourceCreateConfigurationEditor()
Creates the corresponding preValue editor.
Declaration
protected override IConfigurationEditor CreateConfigurationEditor()
Returns
| Type | Description |
|---|---|
| IConfigurationEditor | The corresponding preValue editor. |
CreateValueEditor()
Creates the corresponding property value editor.
Declaration
protected override IDataValueEditor CreateValueEditor()
Returns
| Type | Description |
|---|---|
| IDataValueEditor | The corresponding property value editor. |
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 |
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.
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 |
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.
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. |
Handle(ContentDeletedNotification)
Handles a notification.
Declaration
public void Handle(ContentDeletedNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentDeletedNotification | notification | The notification. |
Handle(MediaDeletedNotification)
Handles a notification.
Declaration
public void Handle(MediaDeletedNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaDeletedNotification | notification | The notification. |
Handle(MediaMovedNotification)
Handles a notification.
Declaration
public void Handle(MediaMovedNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaMovedNotification | notification | The notification. |
Handle(MediaMovedToRecycleBinNotification)
Handles a notification.
Declaration
public void Handle(MediaMovedToRecycleBinNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaMovedToRecycleBinNotification | notification | The notification. |
Handle(MediaSavingNotification)
Handles a notification.
Declaration
public void Handle(MediaSavingNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaSavingNotification | notification | The notification. |
Handle(MemberDeletedNotification)
Handles a notification.
Declaration
public void Handle(MemberDeletedNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| MemberDeletedNotification | notification | The notification. |
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, |
Returns
| Type | Description |
|---|---|
| bool |
|