Files
Umbraco-CMS/src/Umbraco.Core/PropertyEditors/MediaPickerConfigurationEditor.cs
Nikolaj Geisle 70a34105e0 V11: obsolete legacy data types (#13953)
* Obsolete the grid

* Obsolete the legacy media picker

* Obsolete nested content

---------

Co-authored-by: Zeegaan <nge@umbraco.dk>
2023-03-13 11:33:27 +01:00

48 lines
1.8 KiB
C#

// Copyright (c) Umbraco.
// See LICENSE for more details.
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.IO;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Core.PropertyEditors;
/// <summary>
/// Represents the configuration editor for the media picker value editor.
/// </summary>
[Obsolete("Please use the MediaPicker3 instead, will be removed in V13")]
public class MediaPickerConfigurationEditor : ConfigurationEditor<MediaPickerConfiguration>
{
// Scheduled for removal in v12
[Obsolete("Please use constructor that takes an IEditorConfigurationParser instead")]
public MediaPickerConfigurationEditor(IIOHelper ioHelper)
: this(ioHelper, StaticServiceProvider.Instance.GetRequiredService<IEditorConfigurationParser>())
{
}
/// <summary>
/// Initializes a new instance of the <see cref="MediaPickerConfigurationEditor" /> class.
/// </summary>
public MediaPickerConfigurationEditor(IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser)
: base(ioHelper, editorConfigurationParser) =>
// configure fields
// this is not part of ContentPickerConfiguration,
// but is required to configure the UI editor (when editing the configuration)
Field(nameof(MediaPickerConfiguration.StartNodeId))
.Config = new Dictionary<string, object> { { "idType", "udi" } };
public override IDictionary<string, object> ToValueEditor(object? configuration)
{
// get the configuration fields
IDictionary<string, object> d = base.ToValueEditor(configuration);
// add extra fields
// not part of ContentPickerConfiguration but used to configure the UI editor
d["idType"] = "udi";
return d;
}
}