Fix merge
This commit is contained in:
@@ -45,7 +45,7 @@ namespace Umbraco.Tests.Routing
|
||||
var umbracoContext = GetUmbracoContext("/", mediaUrlProviders: new[] { _mediaUrlProvider });
|
||||
var publishedContent = CreatePublishedContent(Constants.PropertyEditors.Aliases.UploadField, expected, null);
|
||||
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlProviderMode.Auto, null, null);
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlMode.Auto, null, null);
|
||||
|
||||
Assert.AreEqual(expected, resolvedUrl);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace Umbraco.Tests.Routing
|
||||
var umbracoContext = GetUmbracoContext("/", mediaUrlProviders: new[] { _mediaUrlProvider });
|
||||
var publishedContent = CreatePublishedContent(Constants.PropertyEditors.Aliases.ImageCropper, imageCropperValue, configuration);
|
||||
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlProviderMode.Auto, null, null);
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlMode.Auto, null, null);
|
||||
|
||||
Assert.AreEqual(expected, resolvedUrl);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ namespace Umbraco.Tests.Routing
|
||||
var umbracoContext = GetUmbracoContext("http://localhost", mediaUrlProviders: new[] { _mediaUrlProvider });
|
||||
var publishedContent = CreatePublishedContent(Constants.PropertyEditors.Aliases.UploadField, mediaUrl, null);
|
||||
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlProviderMode.Absolute, null, null);
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlMode.Absolute, null, null);
|
||||
|
||||
Assert.AreEqual(expected, resolvedUrl);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace Umbraco.Tests.Routing
|
||||
var umbracoContext = GetUmbracoContext("/", mediaUrlProviders: new[] { _mediaUrlProvider });
|
||||
var publishedContent = CreatePublishedContent(Constants.PropertyEditors.Aliases.Boolean, "0", null);
|
||||
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "test", UrlProviderMode.Absolute, null, null);
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "test", UrlMode.Absolute, null, null);
|
||||
|
||||
Assert.AreEqual(string.Empty, resolvedUrl);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ namespace Umbraco.Tests.Routing
|
||||
var contentType = new PublishedContentType(666, "alias", PublishedItemType.Content, Enumerable.Empty<string>(), new [] { umbracoFilePropertyType }, ContentVariation.Culture);
|
||||
var publishedContent = new SolidPublishedContent(contentType) {Properties = new[] {property}};
|
||||
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlProviderMode.Auto, "da", null);
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, "umbracoFile", UrlMode.Auto, "da", null);
|
||||
Assert.AreEqual(daMediaUrl, resolvedUrl);
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,8 @@ namespace Umbraco.Tests.Routing
|
||||
SetDomains1();
|
||||
|
||||
var currentUri = new Uri(currentUrl);
|
||||
var result = umbracoContext.UrlProvider.GetUrl(nodeId, absolute, current: currentUri);
|
||||
var mode = absolute ? UrlMode.Absolute : UrlMode.Auto;
|
||||
var result = umbracoContext.UrlProvider.GetUrl(nodeId, mode, current: currentUri);
|
||||
Assert.AreEqual(expected, result);
|
||||
}
|
||||
|
||||
@@ -221,7 +222,8 @@ namespace Umbraco.Tests.Routing
|
||||
SetDomains2();
|
||||
|
||||
var currentUri = new Uri(currentUrl);
|
||||
var result = umbracoContext.UrlProvider.GetUrl(nodeId, absolute, current : currentUri);
|
||||
var mode = absolute ? UrlMode.Absolute : UrlMode.Auto;
|
||||
var result = umbracoContext.UrlProvider.GetUrl(nodeId, mode, current : currentUri);
|
||||
Assert.AreEqual(expected, result);
|
||||
}
|
||||
|
||||
@@ -245,7 +247,8 @@ namespace Umbraco.Tests.Routing
|
||||
SetDomains3();
|
||||
|
||||
var currentUri = new Uri(currentUrl);
|
||||
var result = umbracoContext.UrlProvider.GetUrl(nodeId, absolute, current : currentUri);
|
||||
var mode = absolute ? UrlMode.Absolute : UrlMode.Auto;
|
||||
var result = umbracoContext.UrlProvider.GetUrl(nodeId, mode, current : currentUri);
|
||||
Assert.AreEqual(expected, result);
|
||||
}
|
||||
|
||||
@@ -275,7 +278,8 @@ namespace Umbraco.Tests.Routing
|
||||
SetDomains4();
|
||||
|
||||
var currentUri = new Uri(currentUrl);
|
||||
var result = umbracoContext.UrlProvider.GetUrl(nodeId, absolute, current : currentUri);
|
||||
var mode = absolute ? UrlMode.Absolute : UrlMode.Auto;
|
||||
var result = umbracoContext.UrlProvider.GetUrl(nodeId, mode, current : currentUri);
|
||||
Assert.AreEqual(expected, result);
|
||||
}
|
||||
|
||||
@@ -295,17 +299,17 @@ namespace Umbraco.Tests.Routing
|
||||
SetDomains4();
|
||||
|
||||
string ignore;
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(1001, false, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(10011, false, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(100111, false, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(10012, false, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(100121, false, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(10013, false, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(1002, false, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(1001, false, current: new Uri("http://domain2.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(10011, false, current: new Uri("http://domain2.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(100111, false, current: new Uri("http://domain2.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(1002, false, current: new Uri("http://domain2.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(1001, UrlMode.Auto, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(10011, UrlMode.Auto, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(100111, UrlMode.Auto, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(10012, UrlMode.Auto, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(100121, UrlMode.Auto, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(10013, UrlMode.Auto, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(1002, UrlMode.Auto, current: new Uri("http://domain1.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(1001, UrlMode.Auto, current: new Uri("http://domain2.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(10011, UrlMode.Auto, current: new Uri("http://domain2.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(100111, UrlMode.Auto, current: new Uri("http://domain2.com"));
|
||||
ignore = umbracoContext.UrlProvider.GetUrl(1002, UrlMode.Auto, current: new Uri("http://domain2.com"));
|
||||
|
||||
var cache = umbracoContext.Content as PublishedContentCache;
|
||||
if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported.");
|
||||
@@ -324,15 +328,15 @@ namespace Umbraco.Tests.Routing
|
||||
CheckRoute(cachedRoutes, cachedIds, 1002, "/1002");
|
||||
|
||||
// use the cache
|
||||
Assert.AreEqual("/", umbracoContext.UrlProvider.GetUrl(1001, false, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/en/", umbracoContext.UrlProvider.GetUrl(10011, false, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/en/1001-1-1/", umbracoContext.UrlProvider.GetUrl(100111, false, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/fr/", umbracoContext.UrlProvider.GetUrl(10012, false, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/fr/1001-2-1/", umbracoContext.UrlProvider.GetUrl(100121, false, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/1001-3/", umbracoContext.UrlProvider.GetUrl(10013, false, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/1002/", umbracoContext.UrlProvider.GetUrl(1002, false, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/", umbracoContext.UrlProvider.GetUrl(1001, UrlMode.Auto, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/en/", umbracoContext.UrlProvider.GetUrl(10011, UrlMode.Auto, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/en/1001-1-1/", umbracoContext.UrlProvider.GetUrl(100111, UrlMode.Auto, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/fr/", umbracoContext.UrlProvider.GetUrl(10012, UrlMode.Auto, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/fr/1001-2-1/", umbracoContext.UrlProvider.GetUrl(100121, UrlMode.Auto, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/1001-3/", umbracoContext.UrlProvider.GetUrl(10013, UrlMode.Auto, current: new Uri("http://domain1.com")));
|
||||
Assert.AreEqual("/1002/", umbracoContext.UrlProvider.GetUrl(1002, UrlMode.Auto, current: new Uri("http://domain1.com")));
|
||||
|
||||
Assert.AreEqual("http://domain1.com/fr/1001-2-1/", umbracoContext.UrlProvider.GetUrl(100121, false, current: new Uri("http://domain2.com")));
|
||||
Assert.AreEqual("http://domain1.com/fr/1001-2-1/", umbracoContext.UrlProvider.GetUrl(100121, UrlMode.Auto, current: new Uri("http://domain2.com")));
|
||||
}
|
||||
|
||||
private static void CheckRoute(IDictionary<int, string> routes, IDictionary<string, int> ids, int id, string route)
|
||||
@@ -381,7 +385,7 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
SetDomains5();
|
||||
|
||||
var url = umbracoContext.UrlProvider.GetUrl(100111, true);
|
||||
var url = umbracoContext.UrlProvider.GetUrl(100111, UrlMode.Absolute);
|
||||
Assert.AreEqual("http://domain1.com/en/1001-1-1/", url);
|
||||
|
||||
var result = umbracoContext.UrlProvider.GetOtherUrls(100111).ToArray();
|
||||
|
||||
@@ -5,6 +5,7 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -44,7 +45,7 @@ namespace Umbraco.Tests.Routing
|
||||
{
|
||||
new DefaultUrlProvider(settings.RequestHandler, Logger, globalSettings.Object, new SiteDomainHelper())
|
||||
}, globalSettings:globalSettings.Object);
|
||||
Assert.AreEqual("http://domain2.com/1001-1-1/", umbracoContext.UrlProvider.GetUrl(100111, true));
|
||||
Assert.AreEqual("http://domain2.com/1001-1-1/", umbracoContext.UrlProvider.GetUrl(100111, UrlMode.Absolute));
|
||||
|
||||
// check that the proper route has been cached
|
||||
var cache = umbracoContext.Content as PublishedContentCache;
|
||||
|
||||
@@ -188,5 +188,49 @@ namespace Umbraco.Web
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MediaUrl
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url for the media.
|
||||
/// </summary>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="propertyAlias">The property alias to resolve the url from.</param>
|
||||
/// <param name="culture">The variation language.</param>
|
||||
/// <returns>The url for the content.</returns>
|
||||
/// <remarks>Better use the <c>GetMediaUrl</c> method but that method is here to complement <c>MediaUrlAbsolute()</c>.</remarks>
|
||||
public static string MediaUrl(this IPublishedContent content, string propertyAlias, string culture = null)
|
||||
{
|
||||
var umbracoContext = Composing.Current.UmbracoContext;
|
||||
|
||||
if (umbracoContext == null)
|
||||
throw new InvalidOperationException("Cannot resolve a Url for a content item when Current.UmbracoContext is null.");
|
||||
if (umbracoContext.UrlProvider == null)
|
||||
throw new InvalidOperationException("Cannot resolve a Url for a content item when Current.UmbracoContext.UrlProvider is null.");
|
||||
|
||||
return umbracoContext.UrlProvider.GetMediaUrl(content, propertyAlias, culture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the absolute url for the media.
|
||||
/// </summary>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="propertyAlias">The property alias to resolve the url from.</param>
|
||||
/// <param name="mode">The url mode.</param>
|
||||
/// <param name="culture">The variation language.</param>
|
||||
/// <returns>The absolute url for the media.</returns>
|
||||
public static string MediaUrl(this IPublishedContent content, string propertyAlias, UrlMode mode, string culture = null)
|
||||
{
|
||||
var umbracoContext = Composing.Current.UmbracoContext;
|
||||
|
||||
if (umbracoContext == null)
|
||||
throw new InvalidOperationException("Cannot resolve a Url for a content item when Current.UmbracoContext is null.");
|
||||
if (umbracoContext.UrlProvider == null)
|
||||
throw new InvalidOperationException("Cannot resolve a Url for a content item when Current.UmbracoContext.UrlProvider is null.");
|
||||
|
||||
return umbracoContext.UrlProvider.GetMediaUrl(content, propertyAlias, mode, culture);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Umbraco.Web.Routing
|
||||
/// <inheritdoc />
|
||||
public virtual UrlInfo GetMediaUrl(UmbracoContext umbracoContext, IPublishedContent content,
|
||||
string propertyAlias,
|
||||
UrlProviderMode mode, string culture, Uri current)
|
||||
UrlMode mode, string culture, Uri current)
|
||||
{
|
||||
var prop = content.GetProperty(propertyAlias);
|
||||
var value = prop?.GetValue(culture);
|
||||
@@ -40,7 +40,7 @@ namespace Umbraco.Web.Routing
|
||||
return url == null ? null : UrlInfo.Url(url.ToString(), culture);
|
||||
}
|
||||
|
||||
private Uri AssembleUrl(string path, Uri current, UrlProviderMode mode)
|
||||
private Uri AssembleUrl(string path, Uri current, UrlMode mode)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return null;
|
||||
@@ -48,15 +48,15 @@ namespace Umbraco.Web.Routing
|
||||
Uri uri;
|
||||
|
||||
if (current == null)
|
||||
mode = UrlProviderMode.Relative; // best we can do
|
||||
mode = UrlMode.Relative; // best we can do
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case UrlProviderMode.Absolute:
|
||||
case UrlMode.Absolute:
|
||||
uri = new Uri(current?.GetLeftPart(UriPartial.Authority) + path);
|
||||
break;
|
||||
case UrlProviderMode.Relative:
|
||||
case UrlProviderMode.Auto:
|
||||
case UrlMode.Relative:
|
||||
case UrlMode.Auto:
|
||||
uri = new Uri(path, UriKind.Relative);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -26,6 +26,6 @@ namespace Umbraco.Web.Routing
|
||||
/// e.g. a cdn url provider will most likely always return an absolute url.</para>
|
||||
/// <para>If the provider is unable to provide a url, it returns <c>null</c>.</para>
|
||||
/// </remarks>
|
||||
UrlInfo GetMediaUrl(UmbracoContext umbracoContext, IPublishedContent content, string propertyAlias, UrlProviderMode mode, string culture, Uri current);
|
||||
UrlInfo GetMediaUrl(UmbracoContext umbracoContext, IPublishedContent content, string propertyAlias, UrlMode mode, string culture, Uri current);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,31 +79,6 @@ namespace Umbraco.Web.Routing
|
||||
private IPublishedContent GetDocument(int id) => _umbracoContext.Content.GetById(id);
|
||||
private IPublishedContent GetDocument(Guid id) => _umbracoContext.Content.GetById(id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="content">The published content.</param>
|
||||
/// <param name="culture">A culture.</param>
|
||||
/// <param name="current">The current absolute url.</param>
|
||||
/// <returns>The url for the published content.</returns>
|
||||
public string GetUrl(IPublishedContent content, string culture = null, Uri current = null)
|
||||
=> GetUrl(content, Mode, culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="content">The published content.</param>
|
||||
/// <param name="absolute">A value indicating whether the url should be absolute in any case.</param>
|
||||
/// <param name="culture">A culture.</param>
|
||||
/// <param name="current">The current absolute url.</param>
|
||||
/// <returns>The url for the published content.</returns>
|
||||
/// <remarks>
|
||||
/// <para>The url is absolute or relative depending on <c>Mode</c> and on <c>current</c>, unless
|
||||
/// <c>absolute</c> is true, in which case the url is always absolute.</para>
|
||||
/// </remarks>
|
||||
public string GetUrl(IPublishedContent content, bool absolute, string culture = null, Uri current = null)
|
||||
=> GetUrl(content, GetMode(absolute), culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
@@ -114,21 +89,6 @@ namespace Umbraco.Web.Routing
|
||||
public string GetUrl(Guid id, string culture = null, Uri current = null)
|
||||
=> GetUrl(GetDocument(id), Mode, culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="id">The published content identifier.</param>
|
||||
/// <param name="absolute">A value indicating whether the url should be absolute in any case.</param>
|
||||
/// <param name="culture">A culture.</param>
|
||||
/// <param name="current">The current absolute url.</param>
|
||||
/// <returns>The url for the published content.</returns>
|
||||
/// <remarks>
|
||||
/// <para>The url is absolute or relative depending on <c>Mode</c> and on <c>current</c>, unless
|
||||
/// <c>absolute</c> is true, in which case the url is always absolute.</para>
|
||||
/// </remarks>
|
||||
public string GetUrl(Guid id, bool absolute, string culture = null, Uri current = null)
|
||||
=> GetUrl(GetDocument(id), GetMode(absolute), culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
@@ -150,21 +110,6 @@ namespace Umbraco.Web.Routing
|
||||
public string GetUrl(int id, string culture = null, Uri current = null)
|
||||
=> GetUrl(GetDocument(id), Mode, culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="id">The published content identifier.</param>
|
||||
/// <param name="absolute">A value indicating whether the url should be absolute in any case.</param>
|
||||
/// <param name="culture">A culture.</param>
|
||||
/// <param name="current">The current absolute url.</param>
|
||||
/// <returns>The url for the published content.</returns>
|
||||
/// <remarks>
|
||||
/// <para>The url is absolute or relative depending on <c>Mode</c> and on <c>current</c>, unless
|
||||
/// <c>absolute</c> is true, in which case the url is always absolute.</para>
|
||||
/// </remarks>
|
||||
public string GetUrl(int id, bool absolute, string culture = null, Uri current = null)
|
||||
=> GetUrl(GetDocument(id), GetMode(absolute), culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
@@ -176,6 +121,16 @@ namespace Umbraco.Web.Routing
|
||||
public string GetUrl(int id, UrlMode mode, string culture = null, Uri current = null)
|
||||
=> GetUrl(GetDocument(id), mode, culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="content">The published content.</param>
|
||||
/// <param name="culture">A culture.</param>
|
||||
/// <param name="current">The current absolute url.</param>
|
||||
/// <returns>The url for the published content.</returns>
|
||||
public string GetUrl(IPublishedContent content, string culture = null, Uri current = null)
|
||||
=> GetUrl(content, Mode, culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
@@ -273,7 +228,7 @@ namespace Umbraco.Web.Routing
|
||||
/// when no culture is specified, the current culture.</para>
|
||||
/// <para>If the provider is unable to provide a url, it returns <see cref="String.Empty"/>.</para>
|
||||
/// </remarks>
|
||||
public string GetMediaUrl(IPublishedContent content, string propertyAlias, UrlMode mode = UrlMode.Wtf, string culture = null, Uri current = null)
|
||||
public string GetMediaUrl(IPublishedContent content, string propertyAlias, string culture = null, Uri current = null)
|
||||
=> GetMediaUrl(content, propertyAlias, Mode, culture, current);
|
||||
|
||||
/// <summary>
|
||||
@@ -281,23 +236,6 @@ namespace Umbraco.Web.Routing
|
||||
/// </summary>
|
||||
/// <param name="content">The published content.</param>
|
||||
/// <param name="propertyAlias">The property alias to resolve the url from.</param>
|
||||
/// <param name="absolute">A value indicating whether the url should be absolute in any case.</param>
|
||||
/// <param name="culture">The variation language.</param>
|
||||
/// <param name="current">The current absolute url.</param>
|
||||
/// <returns>The url for the media.</returns>
|
||||
/// <remarks>
|
||||
/// <para>The url is absolute or relative depending on <c>mode</c> and on <c>current</c>.</para>
|
||||
/// <para>If the media is multi-lingual, gets the url for the specified culture or,
|
||||
/// when no culture is specified, the current culture.</para>
|
||||
/// <para>If the provider is unable to provide a url, it returns <see cref="String.Empty"/>.</para>
|
||||
/// </remarks>
|
||||
public string GetMediaUrl(IPublishedContent content, string propertyAlias, boolx absolute, string culture = null, Uri current = null)
|
||||
=> GetMediaUrl(content, propertyAlias, GetMode(absolute), culture, current);
|
||||
/// <summary>
|
||||
/// Gets the url of a media item.
|
||||
/// </summary>
|
||||
/// <param name="content">The published content.</param>
|
||||
/// <param name="propertyAlias">The property alias to resolve the url from.</param>
|
||||
/// <param name="mode">The url mode.</param>
|
||||
/// <param name="culture">The variation language.</param>
|
||||
/// <param name="current">The current absolute url.</param>
|
||||
@@ -308,9 +246,7 @@ namespace Umbraco.Web.Routing
|
||||
/// when no culture is specified, the current culture.</para>
|
||||
/// <para>If the provider is unable to provide a url, it returns <see cref="String.Empty"/>.</para>
|
||||
/// </remarks>
|
||||
public string GetMediaUrl(IPublishedContent content,
|
||||
string propertyAlias, UrlMode mode = UrlMode.Wtf,
|
||||
string culture = null, Uri current = null)
|
||||
public string GetMediaUrl(IPublishedContent content, string propertyAlias, UrlMode mode, string culture = null, Uri current = null)
|
||||
{
|
||||
if (propertyAlias == null) throw new ArgumentNullException(nameof(propertyAlias));
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace Umbraco.Web
|
||||
[Obsolete("Use the Url() method with UrlMode.Absolute.")]
|
||||
public string UrlAbsolute(int contentId, string culture = null)
|
||||
{
|
||||
return UrlProvider.GetUrl(contentId, true, culture);
|
||||
return UrlProvider.GetUrl(contentId, UrlMode.Absolute, culture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -257,7 +257,7 @@ namespace Umbraco.Web
|
||||
[Obsolete("Use the Url() method with UrlMode.Absolute.")]
|
||||
public string UrlAbsolute(Guid contentId, string culture = null)
|
||||
{
|
||||
return UrlProvider.GetUrl(contentId, true, culture);
|
||||
return UrlProvider.GetUrl(contentId, UrlMode.Absolute, culture);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user