Search Results for

    Show / Hide Table of Contents
    View Source

    Class UmbracoComponentRenderer

    Methods used to render umbraco components as HTML in templates

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Core.Templates
    Assembly: Umbraco.Core.dll
    Syntax
    public class UmbracoComponentRenderer : IUmbracoComponentRenderer
    Remarks

    Used by UmbracoHelper

    Constructors

    View Source

    UmbracoComponentRenderer(IUmbracoContextAccessor, IMacroRenderer, ITemplateRenderer)

    Initializes a new instance of the UmbracoComponentRenderer class.

    Declaration
    public UmbracoComponentRenderer(IUmbracoContextAccessor umbracoContextAccessor, IMacroRenderer macroRenderer, ITemplateRenderer templateRenderer)
    Parameters
    Type Name Description
    IUmbracoContextAccessor umbracoContextAccessor
    IMacroRenderer macroRenderer
    ITemplateRenderer templateRenderer

    Methods

    View Source

    RenderMacroAsync(Int32, String)

    Renders the macro with the specified alias.

    Declaration
    public async 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>
    View Source

    RenderMacroAsync(Int32, String, Nullable<IDictionary<String, Object>>)

    Renders the macro with the specified alias, passing in the specified parameters.

    Declaration
    public async 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>
    View Source

    RenderMacroAsync(Int32, String, Object)

    Renders the macro with the specified alias, passing in the specified parameters.

    Declaration
    public async 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>
    View Source

    RenderMacroForContent(IPublishedContent, String, Nullable<IDictionary<String, Object>>)

    Renders the macro with the specified alias, passing in the specified parameters.

    Declaration
    public async 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

    View Source

    RenderTemplateAsync(Int32, Nullable<Int32>)

    Renders the template for the specified pageId and an optional altTemplateId

    Declaration
    public async 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>
    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • UmbracoComponentRenderer(IUmbracoContextAccessor, IMacroRenderer, ITemplateRenderer)
    • Methods
      • RenderMacroAsync(Int32, String)
      • RenderMacroAsync(Int32, String, Nullable<IDictionary<String, Object>>)
      • RenderMacroAsync(Int32, String, Object)
      • RenderMacroForContent(IPublishedContent, String, Nullable<IDictionary<String, Object>>)
      • RenderTemplateAsync(Int32, Nullable<Int32>)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX