Class ContentRenderingContext
Keeps track of the current context during rendering. This is used e.g. to output edit attributes for correct properties.
Inheritance
Namespace: EPiServer.Web.Templating
Assembly: EPiServer.Cms.AspNetCore.Templating.dll
Version: 12.0.3Syntax
public class ContentRenderingContext : Object
Remarks
In case rendering is done through helper method PropertyFor then the context is created automatically.
Constructors
ContentRenderingContext(ContentRenderingContext, IContentData, TemplateModel, IEnumerable<String>)
Creates a new instance of Content
Declaration
public ContentRenderingContext(ContentRenderingContext parentContext, IContentData content = null, TemplateModel templateModel = null, IEnumerable<string> templateTags = null)
Parameters
Type | Name | Description |
---|---|---|
Content |
parentContext | The parent context of the current context. |
IContent |
content | The current content that is rendered. |
Template |
templateModel | The selected template for rendering |
System. |
templateTags | A list of the current active display tags. |
ContentRenderingContext(ContentRenderingContext, IPropertyDescriptor, TemplateModel, IEnumerable<String>)
Creates a new instance of Content
Declaration
public ContentRenderingContext(ContentRenderingContext parentContext, IPropertyDescriptor propertyDescriptor, TemplateModel templateModel = null, IEnumerable<string> templateTags = null)
Parameters
Type | Name | Description |
---|---|---|
Content |
parentContext | The parent context of the current context. |
IProperty |
propertyDescriptor | A representation of the current property rendered. |
Template |
templateModel | The selected template for rendering |
System. |
templateTags | A list of the current active display tags. |
ContentRenderingContext(ContentRenderingContext, IPropertyDescriptor, Object, IContentData, TemplateModel, IEnumerable<String>)
Creates a new instance of Content
Declaration
public ContentRenderingContext(ContentRenderingContext parentContext, IPropertyDescriptor propertyDescriptor, object model, IContentData contentData = null, TemplateModel templateModel = null, IEnumerable<string> templateTags = null)
Parameters
Type | Name | Description |
---|---|---|
Content |
parentContext | The parent context of the current context. |
IProperty |
propertyDescriptor | A representation of the current property rendered. |
System. |
model | The current model that is rendered. |
IContent |
contentData | The current content that is rendered. |
Template |
templateModel | The template model selected for this model |
System. |
templateTags | A list of the current active display tags. |
Fields
ContentRenderingContextKey
Marker to indicate the text which is stored in httpContext.Items.
Declaration
public const string ContentRenderingContextKey = "Epi:ContentRenderingContext"
Field Value
Type | Description |
---|---|
System. |
Properties
Content
Gets the current content rendering.
Declaration
public IContentData Content { get; }
Property Value
Type | Description |
---|---|
IContent |
The content. |
ContentLink
Gets the content reference for current content
Declaration
public ContentReference ContentLink { get; }
Property Value
Type | Description |
---|---|
Content |
Model
Gets the current model that is rendered.
Declaration
public object Model { get; }
Property Value
Type | Description |
---|---|
System. |
Remarks
When inside the context of rendering a specific property this is the property value.
When current rendering is inside a content context but not inside a specific property (e.g. when a content area item is rendered or top level context) rendering the model is content item.
ParentContext
In case the current model is rendered in context of another model. For example when a content item is rendered within a content area.
Declaration
public ContentRenderingContext ParentContext { get; }
Property Value
Type | Description |
---|---|
Content |
PropertyDescriptor
A representation of the current property rendered.
Declaration
public IPropertyDescriptor PropertyDescriptor { get; }
Property Value
Type | Description |
---|---|
IProperty |
SelectedTemplate
Gets the current template selected to render this model, if any
Declaration
public TemplateModel SelectedTemplate { get; }
Property Value
Type | Description |
---|---|
Template |
TemplateTags
Gets a list of the current active template tags.
Declaration
public IEnumerable<string> TemplateTags { get; }
Property Value
Type | Description |
---|---|
System. |
Remarks
Tags are combined with display tags from parent context.