Adds new ValueReference classes and update to Interface for IsForEditor method to check if we should get references for a specific dataeditor based on its alias

This commit is contained in:
Warren Buckley
2019-11-27 20:24:16 +00:00
parent 7573d52807
commit 645a30a8aa
24 changed files with 281 additions and 130 deletions

View File

@@ -23,25 +23,12 @@ namespace Umbraco.Web.PropertyEditors
protected override IDataValueEditor CreateValueEditor() => new MultiNodeTreePickerPropertyValueEditor(Attribute);
public class MultiNodeTreePickerPropertyValueEditor : DataValueEditor, IDataValueReference
public class MultiNodeTreePickerPropertyValueEditor : DataValueEditor
{
public MultiNodeTreePickerPropertyValueEditor(DataEditorAttribute attribute): base(attribute)
{
}
public IEnumerable<UmbracoEntityReference> GetReferences(object value)
{
var asString = value == null ? string.Empty : value is string str ? str : value.ToString();
var udiPaths = asString.Split(',');
foreach (var udiPath in udiPaths)
{
if (Udi.TryParse(udiPath, out var udi))
yield return new UmbracoEntityReference(udi);
}
}
}
}