Moved needed extension methods for the Gallery snippet..
This commit is contained in:
@@ -97,31 +97,6 @@ namespace Umbraco.Web
|
||||
|
||||
#endregion
|
||||
|
||||
#region MediaUrl
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url for a media.
|
||||
/// </summary>
|
||||
/// <param name="content">The content item.</param>
|
||||
/// <param name="culture">The culture (use current culture by default).</param>
|
||||
/// <param name="mode">The url mode (use site configuration by default).</param>
|
||||
/// <param name="propertyAlias">The alias of the property (use 'umbracoFile' by default).</param>
|
||||
/// <returns>The url for the media.</returns>
|
||||
/// <remarks>
|
||||
/// <para>The value of this property is contextual. It depends on the 'current' request uri,
|
||||
/// if any. In addition, when the content type is multi-lingual, this is the url for the
|
||||
/// specified culture. Otherwise, it is the invariant url.</para>
|
||||
/// </remarks>
|
||||
public static string MediaUrl(this IPublishedContent content, string culture = null, UrlMode mode = UrlMode.Default, string propertyAlias = Constants.Conventions.Media.File)
|
||||
{
|
||||
var publishedUrlProvider = Current.PublishedUrlProvider;
|
||||
|
||||
if (publishedUrlProvider== null)
|
||||
throw new InvalidOperationException("Cannot resolve a Url when Current.PublishedUrlProvider is null.");
|
||||
|
||||
return publishedUrlProvider.GetMediaUrl(content, mode, culture, propertyAlias);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user