Class SitecoreFieldExtensions

Version: 21.x

Set of extension methods for Sitecore fields.

Inheritance

System.Object

SitecoreFieldExtensions

Namespace: Sitecore.AspNet.RenderingEngine.Extensions

Assembly: Sitecore.AspNet.RenderingEngine.dll

Syntax
public static class SitecoreFieldExtensions : Object

Methods

Gets modified URL string to Sitecore media item.

Declaration
public static string GetMediaLink(this ImageField imageField, object imageParams)
Parameters
TypeNameDescription
ImageFieldimageFieldThe image field.
System.ObjectimageParamsImage parameters, example: new { mw = 100, mh = 50 }. IMPORTANT: All the parameters you pass must be whitelisted for resizing to occur. See /sitecore/config/*.config (search for 'allowedMediaParams').
Returns
TypeDescription
System.StringMedia item URL.
If you have suggestions for improving this article, let us know!