Internalizes new methods classes + cleanup
This commit is contained in:
@@ -7,7 +7,7 @@ namespace Umbraco.Core
|
||||
/// <summary>
|
||||
/// Defines the identifiers for Umbraco data types as constants for easy centralized access/management.
|
||||
/// </summary>
|
||||
public static class DataTypes
|
||||
internal static class DataTypes
|
||||
{
|
||||
|
||||
public static class ReservedPreValueKeys
|
||||
|
||||
+12
-4
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
public static class DataTypeDefinitionExtensions
|
||||
internal static class DataTypeExtensions
|
||||
{
|
||||
private static readonly ISet<Guid> IdsOfBuildInDataTypes = new HashSet<Guid>()
|
||||
{
|
||||
@@ -37,11 +37,19 @@ namespace Umbraco.Core.Models
|
||||
/// <summary>
|
||||
/// Returns true if this date type is build-in/default.
|
||||
/// </summary>
|
||||
/// <param name="dataTypeDefinition">The data type definition.</param>
|
||||
/// <param name="dataType">The data type definition.</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsBuildInDataType(this IDataTypeDefinition dataTypeDefinition)
|
||||
public static bool IsBuildInDataType(this IDataTypeDefinition dataType)
|
||||
{
|
||||
return IdsOfBuildInDataTypes.Contains(dataTypeDefinition.Key);
|
||||
return IsBuildInDataType(dataType.Key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this date type is build-in/default.
|
||||
/// </summary>
|
||||
public static bool IsBuildInDataType(Guid key)
|
||||
{
|
||||
return IdsOfBuildInDataTypes.Contains(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,20 @@
|
||||
using System;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Core.Services
|
||||
{
|
||||
public static class DateTypeServiceExtensions
|
||||
internal static class DateTypeServiceExtensions
|
||||
{
|
||||
public static bool IsDataTypeIgnoringUserStartNodes(this IDataTypeService dataTypeService, Guid key)
|
||||
{
|
||||
if (DataTypeExtensions.IsBuildInDataType(key)) return false; //built in ones can never be ignoring start nodes
|
||||
|
||||
var dataType = dataTypeService.GetDataTypeDefinitionById(key);
|
||||
|
||||
if (dataType != null)
|
||||
{
|
||||
var preValues = dataTypeService.GetPreValuesCollectionByDataTypeId(dataType.Id);
|
||||
if (preValues.PreValuesAsDictionary.TryGetValue(
|
||||
if (preValues.FormatAsDictionary().TryGetValue(
|
||||
Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, out var preValue))
|
||||
return preValue.Value.InvariantEquals("1");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user