AB3329 - Added Content picker references
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.Editors;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Web.PropertyEditors
|
||||
@@ -25,5 +26,23 @@ namespace Umbraco.Web.PropertyEditors
|
||||
{
|
||||
return new ContentPickerConfigurationEditor();
|
||||
}
|
||||
|
||||
protected override IDataValueEditor CreateValueEditor() => new ContentPickerPropertyValueEditor(Attribute);
|
||||
|
||||
internal class ContentPickerPropertyValueEditor : DataValueEditor, IDataValueReference
|
||||
{
|
||||
public ContentPickerPropertyValueEditor(DataEditorAttribute attribute) : base(attribute)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<UmbracoEntityReference> GetReferences(object value)
|
||||
{
|
||||
if (value == null) yield break;
|
||||
|
||||
var asString = value is string str ? str : value.ToString();
|
||||
|
||||
yield return new UmbracoEntityReference(Udi.Parse(asString));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user