Variant names, availability, etc
This commit is contained in:
@@ -21,7 +21,6 @@ namespace Umbraco.Core.Models
|
||||
private DateTime? _expireDate;
|
||||
private Dictionary<int, string> _publishNames;
|
||||
|
||||
private static readonly Dictionary<int, string> NoPublishNames = new Dictionary<int, string>();
|
||||
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
|
||||
|
||||
/// <summary>
|
||||
@@ -201,7 +200,7 @@ namespace Umbraco.Core.Models
|
||||
|
||||
/// <inheritdoc/>
|
||||
[IgnoreDataMember]
|
||||
public IReadOnlyDictionary<int, string> PublishNames => _publishNames ?? NoPublishNames;
|
||||
public IReadOnlyDictionary<int, string> PublishNames => _publishNames ?? NoNames;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string GetPublishName(int? languageId)
|
||||
@@ -238,6 +237,7 @@ namespace Umbraco.Core.Models
|
||||
return;
|
||||
}
|
||||
|
||||
if (_publishNames == null) return;
|
||||
_publishNames.Remove(languageId.Value);
|
||||
if (_publishNames.Count == 0)
|
||||
_publishNames = null;
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Umbraco.Core.Models
|
||||
[DebuggerDisplay("Id: {Id}, Name: {Name}, ContentType: {ContentTypeBase.Alias}")]
|
||||
public abstract class ContentBase : TreeEntityBase, IContentBase
|
||||
{
|
||||
protected static readonly Dictionary<int, string> NoNames = new Dictionary<int, string>();
|
||||
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
|
||||
|
||||
private int _contentTypeId;
|
||||
@@ -124,7 +125,7 @@ namespace Umbraco.Core.Models
|
||||
[DataMember]
|
||||
public virtual IReadOnlyDictionary<int, string> Names
|
||||
{
|
||||
get => _names;
|
||||
get => _names ?? NoNames;
|
||||
set
|
||||
{
|
||||
foreach (var (languageId, name) in value)
|
||||
|
||||
Reference in New Issue
Block a user