From e34728c10c06bad075d81dbc1d1d3694e4a42b85 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 23 Oct 2018 23:04:53 +1100 Subject: [PATCH] fixes drop down pre value editor --- .../DropDownFlexibleConfigurationEditor.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/PropertyEditors/DropDownFlexibleConfigurationEditor.cs b/src/Umbraco.Web/PropertyEditors/DropDownFlexibleConfigurationEditor.cs index 5821823576..dbdedebd0a 100644 --- a/src/Umbraco.Web/PropertyEditors/DropDownFlexibleConfigurationEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/DropDownFlexibleConfigurationEditor.cs @@ -27,7 +27,13 @@ namespace Umbraco.Web.PropertyEditors // handle multiple if (editorValues.TryGetValue("multiple", out var multipleObj)) - output.Multiple = multipleObj.TryConvertTo(); + { + var convertBool = multipleObj.TryConvertTo(); + if (convertBool.Success) + { + output.Multiple = convertBool.Result; + } + } // auto-assigning our ids, get next id from existing values var nextId = 1; @@ -56,7 +62,10 @@ namespace Umbraco.Web.PropertyEditors public override Dictionary ToConfigurationEditor(DropDownFlexibleConfiguration configuration) { - var items = configuration?.Items.ToDictionary(x => x.Id.ToString(), x => x.Value) ?? new object(); + // map to what the editor expects + var i = 1; + var items = configuration?.Items.ToDictionary(x => x.Id.ToString(), x => new { value = x.Value, sortOrder = i++ }) ?? new object(); + var multiple = configuration?.Multiple ?? false; return new Dictionary