Try our conversational search powered by Generative AI!

Class ContentAreaRenderer

The default implementation for rendering a ContentArea.

Inheritance
System.Object
ContentAreaRenderer
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web.Mvc.Html
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
[ServiceConfiguration(typeof(ContentAreaRenderer), Lifecycle = ServiceInstanceScope.Transient)]
public class ContentAreaRenderer

Constructors

ContentAreaRenderer()

Initializes a new instance of the ContentAreaRenderer class.

Declaration
public ContentAreaRenderer()

ContentAreaRenderer(IContentRenderer, TemplateResolver, IContentAreaItemAttributeAssembler, IContentRepository, IContentAreaLoader)

Initializes a new instance of the ContentAreaRenderer class.

Declaration
public ContentAreaRenderer(IContentRenderer contentRenderer, TemplateResolver templateResolver, IContentAreaItemAttributeAssembler attributeAssembler, IContentRepository contentRepository, IContentAreaLoader contentAreaLoader)
Parameters
Type Name Description
IContentRenderer contentRenderer

The content renderer.

TemplateResolver templateResolver

The template resolver.

IContentAreaItemAttributeAssembler attributeAssembler

The attribute assembler generating fragment identification in edit mode.

IContentRepository contentRepository

The content repository.

IContentAreaLoader contentAreaLoader

The content area loader

Properties

ContentRepository

Declaration
protected IContentRepository ContentRepository { get; }
Property Value
Type Description
IContentRepository

Methods

AddNonEmptyCssClass(TagBuilder, String)

Add a css class to the System.Web.Mvc.TagBuilder if it is not null or white space.

Declaration
protected virtual TagBuilder AddNonEmptyCssClass(TagBuilder tagBuilder, string cssClass)
Parameters
Type Name Description
System.Web.Mvc.TagBuilder tagBuilder

The tag builder

System.String cssClass

The class to addd

Returns
Type Description
System.Web.Mvc.TagBuilder

The given tag builder

BeforeRenderContentAreaItemStartTag(TagBuilder, ContentAreaItem)

Executed before the ContentFragment start tag has been written. Use this to modify the ContentFragments start tag.

Declaration
protected virtual void BeforeRenderContentAreaItemStartTag(TagBuilder tagBuilder, ContentAreaItem contentAreaItem)
Parameters
Type Name Description
System.Web.Mvc.TagBuilder tagBuilder

The tag builder

ContentAreaItem contentAreaItem

The content area item

GetContentAreaHtmlTag(HtmlHelper, ContentArea)

Gets the html tag for the container. Looks in the view data for the RenderSettings.CustomTag setting.

Declaration
protected virtual string GetContentAreaHtmlTag(HtmlHelper htmlHelper, ContentArea contentArea)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The html helper

ContentArea contentArea

The content area

Returns
Type Description
System.String

The container html tag

GetContentAreaItemCssClass(HtmlHelper, ContentAreaItem)

Gets the css class for the content area item. Looks in the view data for the RenderSettings.ChildrenCssClass setting.

Declaration
protected virtual string GetContentAreaItemCssClass(HtmlHelper htmlHelper, ContentAreaItem contentAreaItem)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The html helper

ContentAreaItem contentAreaItem

The content area item

Returns
Type Description
System.String

The css class for the content area item

GetContentAreaItemHtmlTag(HtmlHelper, ContentAreaItem)

Gets the html tag for the content area item. Looks in the view data for the RenderSettings.ChildrenCustomTag setting.

Declaration
protected virtual string GetContentAreaItemHtmlTag(HtmlHelper htmlHelper, ContentAreaItem contentAreaItem)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The html helper

ContentAreaItem contentAreaItem

The content area item

Returns
Type Description
System.String

The html tag for the content area item

GetContentAreaItemTemplateTag(HtmlHelper, ContentAreaItem)

Gets the template tag for the ContentAreaItem. If a tag is defined on the display options for the ContentAreaItem then that is used; otherwise it uses the content areas template tag.

Declaration
protected virtual string GetContentAreaItemTemplateTag(HtmlHelper htmlHelper, ContentAreaItem contentAreaItem)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The html helper

ContentAreaItem contentAreaItem

The content area item

Returns
Type Description
System.String

The template tag for the content area item

GetContentAreaTemplateTag(HtmlHelper)

Gets the template tag for the ContentArea. Looks in the view data for the RenderSettings.Tag setting.

Declaration
protected virtual string GetContentAreaTemplateTag(HtmlHelper htmlHelper)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The html helper

Returns
Type Description
System.String

The template tag

IsInEditMode(HtmlHelper)

Determines if the request context is in edit mode.

Declaration
protected virtual bool IsInEditMode(HtmlHelper htmlHelper)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The html helper

Returns
Type Description
System.Boolean
true
if the context is in edit mode; otherwise
false

Render(HtmlHelper, ContentArea)

Renders the ContentArea to the writer on the current System.Web.Mvc.HtmlHelper.

Declaration
public virtual void Render(HtmlHelper htmlHelper, ContentArea contentArea)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The Html helper

ContentArea contentArea

The content area

RenderContentAreaItem(HtmlHelper, ContentAreaItem, String, String, String)

Render a ContentAreaItem.

Declaration
protected virtual void RenderContentAreaItem(HtmlHelper htmlHelper, ContentAreaItem contentAreaItem, string templateTag, string htmlTag, string cssClass)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The html helper

ContentAreaItem contentAreaItem

The content area item to render

System.String templateTag

The template tag used to resolve the display template

System.String htmlTag

The html tag for the element wrapping the display template

System.String cssClass

The css class for the element wrapping the display template

RenderContentAreaItems(HtmlHelper, IEnumerable<ContentAreaItem>)

Render the ContentAreaItems.

Declaration
protected virtual void RenderContentAreaItems(HtmlHelper htmlHelper, IEnumerable<ContentAreaItem> contentAreaItems)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The html helper

System.Collections.Generic.IEnumerable<ContentAreaItem> contentAreaItems

The content area items to render

ResolveTemplate(HtmlHelper, IContent, String)

Resolve the template for the ContentAreaItem based on the template tag.

Declaration
protected virtual TemplateModel ResolveTemplate(HtmlHelper htmlHelper, IContent content, string templateTag)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The html helper

IContent content

The content.

System.String templateTag

The template tag used to resolve the display template

Returns
Type Description
TemplateModel

A template model

ShouldRenderWrappingElement(HtmlHelper)

Determine whether a container element should be rendered around the content fragments. Looks in the view data for the RenderSettings.HasContainerElement setting. Defaults to true if not defined.

Declaration
protected virtual bool ShouldRenderWrappingElement(HtmlHelper htmlHelper)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The html helper

Returns
Type Description
System.Boolean

The value set in the view data; otherwise true

Extension Methods