Class UrlHelperRenderExtensions
Extension methods for UrlHelper for use in templates
Inheritance
Namespace: Umbraco.Web
Assembly: Umbraco.Web.dll
Syntax
public static class UrlHelperRenderExtensions
Methods
View SourceGetCropUrl(UrlHelper, String, Nullable<Int32>, Nullable<Int32>, String, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, String, String, Nullable<ImageCropRatioMode>, Boolean, Boolean)
Gets the ImageProcessor URL from the image path.
Declaration
public static IHtmlString GetCropUrl(this UrlHelper urlHelper, string imageUrl, int? width = null, int? height = null, string imageCropperValue = null, string cropAlias = null, int? quality = null, ImageCropMode? imageCropMode = null, ImageCropAnchor? imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, string cacheBusterValue = null, string furtherOptions = null, ImageCropRatioMode? ratioMode = null, bool upScale = true, bool htmlEncode = true)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | urlHelper | |
System.String | imageUrl | The image URL. |
System.Nullable<System.Int32> | width | The width of the output image. |
System.Nullable<System.Int32> | height | The height of the output image. |
System.String | imageCropperValue | The Json data from the Umbraco Core Image Cropper property editor |
System.String | cropAlias | The crop alias. |
System.Nullable<System.Int32> | quality | Quality percentage of the output image. |
System.Nullable<ImageCropMode> | imageCropMode | The image crop mode. |
System.Nullable<ImageCropAnchor> | imageCropAnchor | The image crop anchor. |
System.Boolean | preferFocalPoint | Use focal point to generate an output image using the focal point instead of the predefined crop if there is one |
System.Boolean | useCropDimensions | Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters |
System.String | cacheBusterValue | Add a serialized date of the last edit of the item to ensure client cache refresh when updated |
System.String | furtherOptions | These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
furtherOptions: "&bgcolor=fff" |
System.Nullable<ImageCropRatioMode> | ratioMode | Use a dimension as a ratio |
System.Boolean | upScale | If the image should be upscaled to requested dimensions |
System.Boolean | htmlEncode | Whether to HTML encode this URL - default is true - w3c standards require HTML attributes to be HTML encoded but this can be set to false if using the result of this method for CSS. |
Returns
Type | Description |
---|---|
System.Web.IHtmlString | The System.String. |
GetCropUrl(UrlHelper, MediaWithCrops, Nullable<Int32>, Nullable<Int32>, String, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, Boolean, String, Nullable<ImageCropRatioMode>, Boolean, Boolean)
Declaration
public static IHtmlString GetCropUrl(this UrlHelper urlHelper, MediaWithCrops mediaWithCrops, int? width = null, int? height = null, string propertyAlias = "umbracoFile", string cropAlias = null, int? quality = null, ImageCropMode? imageCropMode = null, ImageCropAnchor? imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, bool cacheBuster = true, string furtherOptions = null, ImageCropRatioMode? ratioMode = null, bool upScale = true, bool htmlEncode = true)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | urlHelper | |
MediaWithCrops | mediaWithCrops | |
System.Nullable<System.Int32> | width | |
System.Nullable<System.Int32> | height | |
System.String | propertyAlias | |
System.String | cropAlias | |
System.Nullable<System.Int32> | quality | |
System.Nullable<ImageCropMode> | imageCropMode | |
System.Nullable<ImageCropAnchor> | imageCropAnchor | |
System.Boolean | preferFocalPoint | |
System.Boolean | useCropDimensions | |
System.Boolean | cacheBuster | |
System.String | furtherOptions | |
System.Nullable<ImageCropRatioMode> | ratioMode | |
System.Boolean | upScale | |
System.Boolean | htmlEncode |
Returns
Type | Description |
---|---|
System.Web.IHtmlString |
GetCropUrl(UrlHelper, MediaWithCrops, String, Boolean)
Declaration
public static IHtmlString GetCropUrl(this UrlHelper urlHelper, MediaWithCrops mediaWithCrops, string cropAlias, bool htmlEncode = true)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | urlHelper | |
MediaWithCrops | mediaWithCrops | |
System.String | cropAlias | |
System.Boolean | htmlEncode |
Returns
Type | Description |
---|---|
System.Web.IHtmlString |
GetCropUrl(UrlHelper, MediaWithCrops, String, String, Boolean)
Declaration
public static IHtmlString GetCropUrl(this UrlHelper urlHelper, MediaWithCrops mediaWithCrops, string propertyAlias, string cropAlias, bool htmlEncode = true)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | urlHelper | |
MediaWithCrops | mediaWithCrops | |
System.String | propertyAlias | |
System.String | cropAlias | |
System.Boolean | htmlEncode |
Returns
Type | Description |
---|---|
System.Web.IHtmlString |
GetCropUrl(UrlHelper, IPublishedContent, Nullable<Int32>, Nullable<Int32>, String, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, Boolean, String, Nullable<ImageCropRatioMode>, Boolean, Boolean)
Gets the ImageProcessor URL from the image path.
Declaration
public static IHtmlString GetCropUrl(this UrlHelper urlHelper, IPublishedContent mediaItem, int? width = null, int? height = null, string propertyAlias = "umbracoFile", string cropAlias = null, int? quality = null, ImageCropMode? imageCropMode = null, ImageCropAnchor? imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, bool cacheBuster = true, string furtherOptions = null, ImageCropRatioMode? ratioMode = null, bool upScale = true, bool htmlEncode = true)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | urlHelper | |
IPublishedContent | mediaItem | The IPublishedContent item. |
System.Nullable<System.Int32> | width | The width of the output image. |
System.Nullable<System.Int32> | height | The height of the output image. |
System.String | propertyAlias | Property alias of the property containing the Json data. |
System.String | cropAlias | The crop alias. |
System.Nullable<System.Int32> | quality | Quality percentage of the output image. |
System.Nullable<ImageCropMode> | imageCropMode | The image crop mode. |
System.Nullable<ImageCropAnchor> | imageCropAnchor | The image crop anchor. |
System.Boolean | preferFocalPoint | Use focal point to generate an output image using the focal point instead of the predefined crop if there is one |
System.Boolean | useCropDimensions | Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters |
System.Boolean | cacheBuster | Add a serialized date of the last edit of the item to ensure client cache refresh when updated |
System.String | furtherOptions | These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example:
furtherOptions: "&bgcolor=fff" |
System.Nullable<ImageCropRatioMode> | ratioMode | Use a dimension as a ratio |
System.Boolean | upScale | If the image should be upscaled to requested dimensions |
System.Boolean | htmlEncode | Whether to HTML encode this URL - default is true - w3c standards require HTML attributes to be HTML encoded but this can be set to false if using the result of this method for CSS. |
Returns
Type | Description |
---|---|
System.Web.IHtmlString | The System.String. |
GetCropUrl(UrlHelper, IPublishedContent, String, Boolean)
Gets the ImageProcessor URL of a media item by the crop alias (using default media item property alias of "umbracoFile")
Declaration
public static IHtmlString GetCropUrl(this UrlHelper urlHelper, IPublishedContent mediaItem, string cropAlias, bool htmlEncode = true)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | urlHelper | |
IPublishedContent | mediaItem | The IPublishedContent item. |
System.String | cropAlias | The crop alias e.g. thumbnail |
System.Boolean | htmlEncode | Whether to HTML encode this URL - default is true - w3c standards require HTML attributes to be HTML encoded but this can be set to false if using the result of this method for CSS. |
Returns
Type | Description |
---|---|
System.Web.IHtmlString |
GetCropUrl(UrlHelper, IPublishedContent, String, String, Boolean)
Gets the ImageProcessor URL by the crop alias using the specified property containing the image cropper Json data on the IPublishedContent item.
Declaration
public static IHtmlString GetCropUrl(this UrlHelper urlHelper, IPublishedContent mediaItem, string propertyAlias, string cropAlias, bool htmlEncode = true)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | urlHelper | |
IPublishedContent | mediaItem | The IPublishedContent item. |
System.String | propertyAlias | The property alias of the property containing the Json data e.g. umbracoFile |
System.String | cropAlias | The crop alias e.g. thumbnail |
System.Boolean | htmlEncode | Whether to HTML encode this URL - default is true - w3c standards require HTML attributes to be HTML encoded but this can be set to false if using the result of this method for CSS. |
Returns
Type | Description |
---|---|
System.Web.IHtmlString | The ImageProcessor.Web URL. |
GetCropUrl(UrlHelper, ImageCropperValue, Nullable<Int32>, Nullable<Int32>, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, String, String, Nullable<ImageCropRatioMode>, Boolean, Boolean)
Declaration
public static IHtmlString GetCropUrl(this UrlHelper urlHelper, ImageCropperValue imageCropperValue, int? width = null, int? height = null, string cropAlias = null, int? quality = null, ImageCropMode? imageCropMode = null, ImageCropAnchor? imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, string cacheBusterValue = null, string furtherOptions = null, ImageCropRatioMode? ratioMode = null, bool upScale = true, bool htmlEncode = true)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | urlHelper | |
ImageCropperValue | imageCropperValue | |
System.Nullable<System.Int32> | width | |
System.Nullable<System.Int32> | height | |
System.String | cropAlias | |
System.Nullable<System.Int32> | quality | |
System.Nullable<ImageCropMode> | imageCropMode | |
System.Nullable<ImageCropAnchor> | imageCropAnchor | |
System.Boolean | preferFocalPoint | |
System.Boolean | useCropDimensions | |
System.String | cacheBusterValue | |
System.String | furtherOptions | |
System.Nullable<ImageCropRatioMode> | ratioMode | |
System.Boolean | upScale | |
System.Boolean | htmlEncode |
Returns
Type | Description |
---|---|
System.Web.IHtmlString |
SurfaceAction(UrlHelper, String, String)
Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
Declaration
public static string SurfaceAction(this UrlHelper url, string action, string controllerName)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | url | |
System.String | action | |
System.String | controllerName |
Returns
Type | Description |
---|---|
System.String |
SurfaceAction(UrlHelper, String, String, Object)
Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
Declaration
public static string SurfaceAction(this UrlHelper url, string action, string controllerName, object additionalRouteVals)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | url | |
System.String | action | |
System.String | controllerName | |
System.Object | additionalRouteVals |
Returns
Type | Description |
---|---|
System.String |
SurfaceAction(UrlHelper, String, String, String, Object)
Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
Declaration
public static string SurfaceAction(this UrlHelper url, string action, string controllerName, string area, object additionalRouteVals)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | url | |
System.String | action | |
System.String | controllerName | |
System.String | area | |
System.Object | additionalRouteVals |
Returns
Type | Description |
---|---|
System.String |
SurfaceAction(UrlHelper, String, Type)
Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
Declaration
public static string SurfaceAction(this UrlHelper url, string action, Type surfaceType)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | url | |
System.String | action | |
System.Type | surfaceType |
Returns
Type | Description |
---|---|
System.String |
SurfaceAction(UrlHelper, String, Type, Object)
Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
Declaration
public static string SurfaceAction(this UrlHelper url, string action, Type surfaceType, object additionalRouteVals)
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | url | |
System.String | action | |
System.Type | surfaceType | |
System.Object | additionalRouteVals |
Returns
Type | Description |
---|---|
System.String |
SurfaceAction<T>(UrlHelper, String)
Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
Declaration
public static string SurfaceAction<T>(this UrlHelper url, string action)
where T : SurfaceController
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | url | |
System.String | action |
Returns
Type | Description |
---|---|
System.String |
Type Parameters
Name | Description |
---|---|
T |
SurfaceAction<T>(UrlHelper, String, Object)
Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
Declaration
public static string SurfaceAction<T>(this UrlHelper url, string action, object additionalRouteVals)
where T : SurfaceController
Parameters
Type | Name | Description |
---|---|---|
UrlHelper | url | |
System.String | action | |
System.Object | additionalRouteVals |
Returns
Type | Description |
---|---|
System.String |
Type Parameters
Name | Description |
---|---|
T |