Review Perplex change for Segments (#7659)

* Fixes incorrect property inheritance logic

* Fixes crash in canVariantPublish when variant.language is null

* Adds variant display name in dropdown

* Logic for invariant properties updated to also support segment invariance

* Properties varied by segment only now properly saved when multiple variants are saved/published

* Logic for disabling property editors moved to function and corrected for all cases of culture/segment properties

* Fixes syntax error in less file

* Fixes empty variants returned from GetEmpty() for a ContentType set to vary by segment
This commit is contained in:
Daniël Knippers
2020-02-14 15:16:50 +01:00
committed by GitHub
parent cac07aa7eb
commit 1a4e6e564c

View File

@@ -113,11 +113,25 @@ namespace Umbraco.Web.Models.Mapping
/// </summary>
/// <param name="content"></param>
/// <returns>
/// Returns all segments assigned to the content including 'null' values
/// Returns all segments assigned to the content including the default `null` segment.
/// </returns>
private IEnumerable<string> GetSegments(IContent content)
{
return content.Properties.SelectMany(p => p.Values.Select(v => v.Segment)).Distinct();
// The current segments of a content item are determined
// entirely on the current property values of the content.
var segments = content.Properties
.SelectMany(p => p.Values.Select(v => v.Segment))
.Distinct()
.ToList();
if(segments.Count == 0)
{
// The default segment is always there,
// even when there is no property data at all yet
segments.Add(null);
}
return segments;
}
private ContentVariantDisplay CreateVariantDisplay(MapperContext context, IContent content, Language language, string segment)