Add additional preview URLs option (#14479)

This commit is contained in:
Kenn Jacobsen
2023-06-30 07:26:31 +02:00
committed by GitHub
parent 4d8409ffdf
commit fad710364c
3 changed files with 20 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ public class ContentVariantDisplay : ITabbedContent<ContentPropertyDisplay>, ICo
Tabs = new List<Tab<ContentPropertyDisplay>>();
Notifications = new List<BackOfficeNotification>();
AllowedActions = Enumerable.Empty<string>();
AdditionalPreviewUrls = Enumerable.Empty<NamedUrl>();
}
[DataMember(Name = "allowedActions", IsRequired = true)]
@@ -72,6 +73,9 @@ public class ContentVariantDisplay : ITabbedContent<ContentPropertyDisplay>, ICo
/// </summary>
[DataMember(Name = "tabs")]
public IEnumerable<Tab<ContentPropertyDisplay>> Tabs { get; set; }
[DataMember(Name = "additionalPreviewUrls")]
public IEnumerable<NamedUrl> AdditionalPreviewUrls { get; set; }
}
public class ContentVariantScheduleDisplay : ContentVariantDisplay

View File

@@ -0,0 +1,13 @@
using System.Runtime.Serialization;
namespace Umbraco.Cms.Core.Models.ContentEditing;
[DataContract(Name = "namedUrl", Namespace = "")]
public class NamedUrl
{
[DataMember(Name = "name")]
public required string Name { get; set; }
[DataMember(Name = "url")]
public required string Url { get; set; }
}

View File

@@ -127,6 +127,7 @@ internal class ContentMapDefinition : IMapDefinition
target.Tabs = source.Tabs;
target.UpdateDate = source.UpdateDate;
target.AllowedActions = source.AllowedActions;
target.AdditionalPreviewUrls = source.AdditionalPreviewUrls;
}
// Umbraco.Code.MapAll
@@ -189,6 +190,7 @@ internal class ContentMapDefinition : IMapDefinition
target.Tabs = source.Tabs;
target.UpdateDate = source.UpdateDate;
target.AllowedActions = source.AllowedActions;
target.AdditionalPreviewUrls = source.AdditionalPreviewUrls;
// We'll only try and map the ReleaseDate/ExpireDate if the "old" ContentVariantScheduleDisplay is in the context, otherwise we'll just skip it quietly.
_ = context.Items.TryGetValue(nameof(ContentItemDisplayWithSchedule.Variants), out var variants);
@@ -352,7 +354,7 @@ internal class ContentMapDefinition : IMapDefinition
return result;
}
// Umbraco.Code.MapAll -Segment -Language -DisplayName
// Umbraco.Code.MapAll -Segment -Language -DisplayName -AdditionalPreviewUrls
private void Map(IContent source, ContentVariantDisplay target, MapperContext context)
{
target.CreateDate = source.CreateDate;