Interface IUmbracoComponentRenderer
Methods used to render umbraco components as HTML in templates
Namespace: Umbraco.Cms.Core.Templates
Assembly: Umbraco.Core.dll
Syntax
public interface IUmbracoComponentRendererMethods
View SourceRenderMacroAsync(Int32, String)
Renders the macro with the specified alias.
Declaration
Task<IHtmlEncodedString> RenderMacroAsync(int contentId, string alias)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | contentId | The content id | 
| System.String | alias | The alias. | 
Returns
| Type | Description | 
|---|---|
| Task<IHtmlEncodedString> | 
RenderMacroAsync(Int32, String, Nullable<IDictionary<String, Object>>)
Renders the macro with the specified alias, passing in the specified parameters.
Declaration
Task<IHtmlEncodedString> RenderMacroAsync(int contentId, string alias, IDictionary<string, object>? parameters)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | contentId | The content id | 
| System.String | alias | The alias. | 
| System.Nullable<IDictionary<System.String, System.Object>> | parameters | The parameters. | 
Returns
| Type | Description | 
|---|---|
| Task<IHtmlEncodedString> | 
RenderMacroAsync(Int32, String, Object)
Renders the macro with the specified alias, passing in the specified parameters.
Declaration
Task<IHtmlEncodedString> RenderMacroAsync(int contentId, string alias, object parameters)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | contentId | The content id | 
| System.String | alias | The alias. | 
| System.Object | parameters | The parameters. | 
Returns
| Type | Description | 
|---|---|
| Task<IHtmlEncodedString> | 
RenderMacroForContent(IPublishedContent, String, Nullable<IDictionary<String, Object>>)
Renders the macro with the specified alias, passing in the specified parameters.
Declaration
Task<IHtmlEncodedString> RenderMacroForContent(IPublishedContent content, string alias, IDictionary<string, object>? parameters)Parameters
| Type | Name | Description | 
|---|---|---|
| IPublishedContent | content | An IPublishedContent to use for the context for the macro rendering | 
| System.String | alias | The alias. | 
| System.Nullable<IDictionary<System.String, System.Object>> | parameters | The parameters. | 
Returns
| Type | Description | 
|---|---|
| Task<IHtmlEncodedString> | A raw HTML string of the macro output | 
Remarks
Currently only used when the node is unpublished and unable to get the contentId item from the content cache as its unpublished. This deals with taking in a preview/draft version of the content node
RenderTemplateAsync(Int32, Nullable<Int32>)
Renders the template for the specified pageId and an optional altTemplateId
Declaration
Task<IHtmlEncodedString> RenderTemplateAsync(int contentId, int? altTemplateId = null)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | contentId | The content id | 
| System.Nullable<System.Int32> | altTemplateId | If not specified, will use the template assigned to the node | 
Returns
| Type | Description | 
|---|---|
| Task<IHtmlEncodedString> |