Move the GetReferences about (back to where it was)
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Umbraco.Web.PropertyEditors
|
||||
ValueType = ValueTypes.Json,
|
||||
Group = Constants.PropertyEditors.Groups.Pickers,
|
||||
Icon = "icon-link")]
|
||||
public class MultiUrlPickerPropertyEditor : DataEditor, IDataValueReference
|
||||
public class MultiUrlPickerPropertyEditor : DataEditor
|
||||
{
|
||||
private readonly IEntityService _entityService;
|
||||
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
|
||||
@@ -29,18 +29,6 @@ namespace Umbraco.Web.PropertyEditors
|
||||
_publishedSnapshotAccessor = publishedSnapshotAccessor ?? throw new ArgumentNullException(nameof(publishedSnapshotAccessor));
|
||||
}
|
||||
|
||||
public IEnumerable<UmbracoEntityReference> GetReferences(object value)
|
||||
{
|
||||
var asString = value == null ? string.Empty : value is string str ? str : value.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(asString)) yield break;
|
||||
|
||||
var links = JsonConvert.DeserializeObject<List<MultiUrlPickerValueEditor.LinkDto>>(asString);
|
||||
foreach (var link in links)
|
||||
if (link.Udi != null) // Links can be absolute links without a Udi
|
||||
yield return new UmbracoEntityReference(link.Udi);
|
||||
}
|
||||
|
||||
protected override IConfigurationEditor CreateConfigurationEditor() => new MultiUrlPickerConfigurationEditor();
|
||||
|
||||
protected override IDataValueEditor CreateValueEditor() => new MultiUrlPickerValueEditor(_entityService, _publishedSnapshotAccessor, Logger, Attribute);
|
||||
|
||||
@@ -15,7 +15,7 @@ using Umbraco.Web.PublishedCache;
|
||||
|
||||
namespace Umbraco.Web.PropertyEditors
|
||||
{
|
||||
public class MultiUrlPickerValueEditor : DataValueEditor
|
||||
public class MultiUrlPickerValueEditor : DataValueEditor, IDataValueReference
|
||||
{
|
||||
private readonly IEntityService _entityService;
|
||||
private readonly ILogger _logger;
|
||||
@@ -156,6 +156,18 @@ namespace Umbraco.Web.PropertyEditors
|
||||
return base.FromEditor(editorValue, currentValue);
|
||||
}
|
||||
|
||||
public IEnumerable<UmbracoEntityReference> GetReferences(object value)
|
||||
{
|
||||
var asString = value == null ? string.Empty : value is string str ? str : value.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(asString)) yield break;
|
||||
|
||||
var links = JsonConvert.DeserializeObject<List<MultiUrlPickerValueEditor.LinkDto>>(asString);
|
||||
foreach (var link in links)
|
||||
if (link.Udi != null) // Links can be absolute links without a Udi
|
||||
yield return new UmbracoEntityReference(link.Udi);
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
internal class LinkDto
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user