Default value editors for all (meaningful) value types (#14928)
* Expose editor UI alias in published property type, so custom value converters can use it
* Add default property value converters for all value types (#14869)
* Add default property value converters for all value types
* Clean up some left-over stuff
(cherry picked from commit ce86abe8ac)
* Added "plain" property editors for all (meaningful) value types
This commit is contained in:
@@ -31,6 +31,11 @@ public interface IPublishedPropertyType
|
||||
/// </summary>
|
||||
string EditorAlias { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the property editor UI alias.
|
||||
/// </summary>
|
||||
string EditorUiAlias { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the property is a user content property.
|
||||
/// </summary>
|
||||
|
||||
@@ -137,5 +137,5 @@ public class PublishedContentTypeFactory : IPublishedContentTypeFactory
|
||||
new PublishedPropertyType(propertyTypeAlias, dataTypeId, umbraco, variations, _propertyValueConverters, _publishedModelFactory, this);
|
||||
|
||||
private PublishedDataType CreatePublishedDataType(IDataType dataType)
|
||||
=> new(dataType.Id, dataType.EditorAlias, dataType is DataType d ? d.GetLazyConfigurationObject() : new Lazy<object?>(() => dataType.ConfigurationObject));
|
||||
=> new(dataType.Id, dataType.EditorAlias, dataType.EditorUiAlias, dataType is DataType d ? d.GetLazyConfigurationObject() : new Lazy<object?>(() => dataType.ConfigurationObject));
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Umbraco.Cms.Core.Models.PublishedContent;
|
||||
@@ -17,15 +18,22 @@ public class PublishedDataType
|
||||
{
|
||||
private readonly Lazy<object?> _lazyConfiguration;
|
||||
|
||||
[Obsolete("Please use the constructor that accepts editor UI alias too. Scheduled for removal in V16.")]
|
||||
public PublishedDataType(int id, string editorAlias, Lazy<object?> lazyConfiguration)
|
||||
: this(id, editorAlias, editorAlias, lazyConfiguration)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PublishedDataType" /> class.
|
||||
/// </summary>
|
||||
public PublishedDataType(int id, string editorAlias, Lazy<object?> lazyConfiguration)
|
||||
public PublishedDataType(int id, string editorAlias, string? editorUiAlias, Lazy<object?> lazyConfiguration)
|
||||
{
|
||||
_lazyConfiguration = lazyConfiguration;
|
||||
|
||||
Id = id;
|
||||
EditorAlias = editorAlias;
|
||||
EditorUiAlias = editorUiAlias ?? editorAlias;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -38,6 +46,11 @@ public class PublishedDataType
|
||||
/// </summary>
|
||||
public string EditorAlias { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data type editor UI alias.
|
||||
/// </summary>
|
||||
public string EditorUiAlias { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data type configuration object.
|
||||
/// </summary>
|
||||
|
||||
@@ -88,6 +88,9 @@ namespace Umbraco.Cms.Core.Models.PublishedContent
|
||||
/// <inheritdoc />
|
||||
public string EditorAlias => DataType.EditorAlias;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string EditorUiAlias => DataType.EditorUiAlias;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsUserProperty { get; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user