V8: Support culture variant URLs in multi URL picker (#7130)
Thanks, Kenn - great work as usual 👍
This commit is contained in:
committed by
emma burstow
parent
12e88fde42
commit
bcf4c97270
@@ -206,6 +206,35 @@ namespace Umbraco.Web.Editors
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of an entity
|
||||
/// </summary>
|
||||
/// <param name="udi">UDI of the entity to fetch URL for</param>
|
||||
/// <param name="culture">The culture to fetch the URL for</param>
|
||||
/// <returns>The URL or path to the item</returns>
|
||||
public HttpResponseMessage GetUrl(Udi udi, string culture = "*")
|
||||
{
|
||||
var intId = Services.EntityService.GetId(udi);
|
||||
if (!intId.Success)
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
UmbracoEntityTypes entityType;
|
||||
switch(udi.EntityType)
|
||||
{
|
||||
case Constants.UdiEntityType.Document:
|
||||
entityType = UmbracoEntityTypes.Document;
|
||||
break;
|
||||
case Constants.UdiEntityType.Media:
|
||||
entityType = UmbracoEntityTypes.Media;
|
||||
break;
|
||||
case Constants.UdiEntityType.Member:
|
||||
entityType = UmbracoEntityTypes.Member;
|
||||
break;
|
||||
default:
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
return GetUrl(intId.Result, entityType, culture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of an entity
|
||||
/// </summary>
|
||||
@@ -303,7 +332,9 @@ namespace Umbraco.Web.Editors
|
||||
[HttpGet]
|
||||
public UrlAndAnchors GetUrlAndAnchors(int id, string culture = "*")
|
||||
{
|
||||
var url = UmbracoContext.UrlProvider.GetUrl(id);
|
||||
culture = culture ?? ClientCulture();
|
||||
|
||||
var url = UmbracoContext.UrlProvider.GetUrl(id, culture: culture);
|
||||
var anchorValues = Services.ContentService.GetAnchorValuesFromRTEs(id, culture);
|
||||
return new UrlAndAnchors(url, anchorValues);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user