Class MultiUrlPickerValueEditor
Provides a value editor implementation for the Multi URL Picker property editor in Umbraco. Handles the editing and processing of multiple URL values selected by users.
Namespace: Umbraco.Cms.Core.PropertyEditors
Assembly: Umbraco.Infrastructure.dll
Syntax
public class MultiUrlPickerValueEditor : DataValueEditor, IDataValueEditor, IDataValueReference, ICacheReferencedEntities
Constructors
View SourceMultiUrlPickerValueEditor(ILogger<MultiUrlPickerValueEditor>, ILocalizedTextService, IShortStringHelper, DataEditorAttribute, IPublishedUrlProvider, IJsonSerializer, IIOHelper, IContentService, IMediaService)
Initializes a new instance of the MultiUrlPickerValueEditor class with the specified dependencies.
Declaration
[Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 19.")]
public MultiUrlPickerValueEditor(ILogger<MultiUrlPickerValueEditor> logger, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute, IPublishedUrlProvider publishedUrlProvider, IJsonSerializer jsonSerializer, IIOHelper ioHelper, IContentService contentService, IMediaService mediaService)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger<MultiUrlPickerValueEditor> | logger | The logger used for logging events and errors. |
| ILocalizedTextService | localizedTextService | The service for retrieving localized text. |
| IShortStringHelper | shortStringHelper | Helper for handling short string operations. |
| DataEditorAttribute | attribute | The data editor attribute that describes the editor. |
| IPublishedUrlProvider | publishedUrlProvider | Provider for published URLs. |
| IJsonSerializer | jsonSerializer | The serializer used for JSON operations. |
| IIOHelper | ioHelper | Helper for IO operations. |
| IContentService | contentService | Service for managing content items. |
| IMediaService | mediaService | Service for managing media items. |
MultiUrlPickerValueEditor(ILogger<MultiUrlPickerValueEditor>, ILocalizedTextService, IShortStringHelper, DataEditorAttribute, IPublishedUrlProvider, IJsonSerializer, IIOHelper, IContentService, IMediaService, AppCaches)
Initializes a new instance of the MultiUrlPickerValueEditor class.
Declaration
public MultiUrlPickerValueEditor(ILogger<MultiUrlPickerValueEditor> logger, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute, IPublishedUrlProvider publishedUrlProvider, IJsonSerializer jsonSerializer, IIOHelper ioHelper, IContentService contentService, IMediaService mediaService, AppCaches appCaches)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger<MultiUrlPickerValueEditor> | logger | The Microsoft.Extensions.Logging.ILogger<TCategoryName> used for logging. |
| ILocalizedTextService | localizedTextService | The ILocalizedTextService for localized text operations. |
| IShortStringHelper | shortStringHelper | The IShortStringHelper for string manipulation. |
| DataEditorAttribute | attribute | The DataEditorAttribute describing the data editor. |
| IPublishedUrlProvider | publishedUrlProvider | The IPublishedUrlProvider for resolving published URLs. |
| IJsonSerializer | jsonSerializer | The IJsonSerializer for JSON serialization. |
| IIOHelper | ioHelper | The IIOHelper for IO operations. |
| IContentService | contentService | The IContentService for content management. |
| IMediaService | mediaService | The IMediaService for media management. |
| AppCaches | appCaches | The AppCaches instance for caching. |
Methods
View SourceCacheReferencedEntities(IEnumerable<object>)
Caches the entities referenced by the provided block data values.
Declaration
public void CacheReferencedEntities(IEnumerable<object> values)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<object> | values | An enumerable collection of block values that may contain the entities to be cached. |
FromEditor(ContentPropertyData, object?)
Converts the value received from the editor (as part of the content property data) into a serialized JSON format suitable for storage.
Declaration
public override object? FromEditor(ContentPropertyData editorValue, object? currentValue)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentPropertyData | editorValue | The content property data containing the value from the editor, expected to be a JSON array of link objects. |
| object | currentValue | The current stored value of the property, if any. |
Returns
| Type | Description |
|---|---|
| object | A JSON string representing the collection of links if valid links are found; otherwise, |
GetReferences(object?)
Extracts entity references from the provided value, which is expected to be a JSON-serialized list of links.
Declaration
public IEnumerable<UmbracoEntityReference> GetReferences(object? value)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value to extract references from. This should be a JSON string representing a collection of links, or |
Returns
| Type | Description |
|---|---|
| IEnumerable<UmbracoEntityReference> | An enumerable of UmbracoEntityReference objects extracted from the value. If the value is |
ToEditor(IProperty, string?, string?)
Converts the property value of a multi-URL picker to an object suitable for use in the editor UI.
Declaration
public override object? ToEditor(IProperty property, string? culture = null, string? segment = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IProperty | property | The property whose value will be converted for the editor. |
| string | culture | The culture to use for value conversion, or |
| string | segment | The segment to use for value conversion, or |
Returns
| Type | Description |
|---|---|
| object | A collection of LinkDisplay objects representing the editor value, or an empty collection if the property value is null or empty. If deserialization fails, the base implementation's result is returned. |