Make Nested Content support variant doctypes

This commit is contained in:
Kenn Jacobsen
2018-11-26 08:56:13 +01:00
committed by Sebastiaan Janssen
parent 7b804e27ad
commit b087b862e8

View File

@@ -175,13 +175,17 @@ namespace Umbraco.Web.PropertyEditors
{
// create a temp property with the value
var tempProp = new Property(propType);
tempProp.SetValue(propValues[propAlias] == null ? null : propValues[propAlias].ToString());
// if the property varies by culture, make sure we save using the current culture
var propCulture = propType.VariesByCulture() || propType.VariesByCultureAndSegment()
? culture
: null;
tempProp.SetValue(propValues[propAlias] == null ? null : propValues[propAlias].ToString(), propCulture);
// convert that temp property, and store the converted value
var propEditor = _propertyEditors[propType.PropertyEditorAlias];
var tempConfig = dataTypeService.GetDataType(propType.DataTypeId).Configuration;
var valEditor = propEditor.GetValueEditor(tempConfig);
var convValue = valEditor.ToEditor(tempProp, dataTypeService);
var convValue = valEditor.ToEditor(tempProp, dataTypeService, propCulture);
propValues[propAlias] = convValue == null ? null : JToken.FromObject(convValue);
}
catch (InvalidOperationException)