From d589115b67de4a6214afc562d2f736a65e8c06b9 Mon Sep 17 00:00:00 2001 From: Mole Date: Wed, 26 Apr 2023 14:51:55 +0200 Subject: [PATCH] Set culture variation when getting property types for indexing (#14167) --- .../NestedPropertyIndexValueFactoryBase.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/NestedPropertyIndexValueFactoryBase.cs b/src/Umbraco.Infrastructure/PropertyEditors/NestedPropertyIndexValueFactoryBase.cs index cc2f8143b8..fa3ae836c1 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/NestedPropertyIndexValueFactoryBase.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/NestedPropertyIndexValueFactoryBase.cs @@ -40,6 +40,23 @@ internal abstract class NestedPropertyIndexValueFactoryBase contentType .PropertyGroups .SelectMany(x => x.PropertyTypes!) + .Select(propertyType => + { + // We want to ensure that the nested properties are set vary by culture if the parent is + // This is because it's perfectly valid to have a nested property type that's set to invariant even if the parent varies. + // For instance in a block list, the list it self can vary, but the elements can be invariant, at the same time. + if (culture is not null) + { + propertyType.Variations |= ContentVariation.Culture; + } + + if (segment is not null) + { + propertyType.Variations |= ContentVariation.Segment; + } + + return propertyType; + }) .ToDictionary(x => x.Alias); result.AddRange(GetNestedResults(