Merge pull request #2014 from umbraco/temp-deploy-348

deploy-348 - add support for languages
This commit is contained in:
Claus
2017-06-22 10:53:31 +02:00
committed by GitHub
4 changed files with 40 additions and 4 deletions

View File

@@ -212,6 +212,16 @@ namespace Umbraco.Core
/// Guid for a Forms DataSource.
/// </summary>
public static readonly Guid FormsDataSourceGuid = new Guid(FormsDataSource);
/// <summary>
/// Guid for a Language.
/// </summary>
public const string Language = "6B05D05B-EC78-49BE-A4E4-79E274F07A77";
/// <summary>
/// Guid for a Forms DataSource.
/// </summary>
public static readonly Guid LanguageGuid = new Guid(Language);
}
}
}

View File

@@ -178,6 +178,13 @@ namespace Umbraco.Core.Models
/// </summary>
[UmbracoObjectType(Constants.ObjectTypes.FormsDataSource)]
[FriendlyName("DataSource")]
FormsDataSource
FormsDataSource,
/// <summary>
/// Language
/// </summary>
[UmbracoObjectType(Constants.ObjectTypes.Language)]
[FriendlyName("Language")]
Language
}
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Models;
namespace Umbraco.Core
@@ -84,6 +83,8 @@ namespace Umbraco.Core
public const string PartialViewMacro = "partial-view-macro";
[UdiType(UdiType.StringUdi)]
public const string Xslt = "xslt";
[UdiType(UdiType.StringUdi)]
public const string Language = "language";
public static string FromUmbracoObjectType(UmbracoObjectTypes umbracoObjectType)
{
@@ -123,6 +124,8 @@ namespace Umbraco.Core
return FormsPreValue;
case UmbracoObjectTypes.FormsDataSource:
return FormsDataSource;
case UmbracoObjectTypes.Language:
return Language;
}
throw new NotSupportedException(string.Format("UmbracoObjectType \"{0}\" does not have a matching EntityType.", umbracoObjectType));
}
@@ -165,6 +168,8 @@ namespace Umbraco.Core
return UmbracoObjectTypes.FormsPreValue;
case FormsDataSource:
return UmbracoObjectTypes.FormsDataSource;
case Language:
return UmbracoObjectTypes.Language;
}
throw new NotSupportedException(
string.Format("EntityType \"{0}\" does not have a matching UmbracoObjectType.", entityType));

View File

@@ -97,7 +97,7 @@ namespace Umbraco.Core
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns>The entity identifier of the entity.</returns>
public static GuidUdi GetUdi(this Umbraco.Core.Models.EntityContainer entity)
public static GuidUdi GetUdi(this EntityContainer entity)
{
if (entity == null) throw new ArgumentNullException("entity");
@@ -246,6 +246,17 @@ namespace Umbraco.Core
return new GuidUdi(Constants.UdiEntityType.RelationType, entity.Key).EnsureClosed();
}
/// <summary>
/// Gets the entity identifier of the entity.
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns>The entity identifier of the entity.</returns>
public static StringUdi GetUdi(this ILanguage entity)
{
if (entity == null) throw new ArgumentNullException("entity");
return new StringUdi(Constants.UdiEntityType.Language, entity.IsoCode).EnsureClosed();
}
/// <summary>
/// Gets the entity identifier of the entity.
/// </summary>
@@ -279,7 +290,7 @@ namespace Umbraco.Core
var dataTypeComposition = entity as IDataTypeDefinition;
if (dataTypeComposition != null) return dataTypeComposition.GetUdi();
var container = entity as Umbraco.Core.Models.EntityContainer;
var container = entity as EntityContainer;
if (container != null) return container.GetUdi();
var media = entity as IMedia;
@@ -315,6 +326,9 @@ namespace Umbraco.Core
var relationType = entity as IRelationType;
if (relationType != null) return relationType.GetUdi();
var language = entity as ILanguage;
if (language != null) return language.GetUdi();
throw new NotSupportedException(string.Format("Entity type {0} is not supported.", entity.GetType().FullName));
}
}