Table of Contents

Interface IRenderService

Namespace
ToSic.Sxc.Services
Assembly
ToSic.Sxc.dll

Block-Rendering system. It's responsible for taking a Block and delivering HTML for the output.
It's used for InnerContent, so that Razor-Code can easily render additional content blocks.
See also Inner Content (Content Within Other Content)

[PublicApi]
public interface IRenderService

Remarks

This replaces the now obsolete ToSic.Sxc.Blocks.Render

History

  • Introduced in v12.05 but on another namespace which still works for compatibility
  • Moved to ToSic.Sxc.Services in v13

Methods

All(ICanBeItem, NoParamOrder, string, string, int, string)

Render content-blocks into a larger html-block containing placeholders

IRawHtmlString All(ICanBeItem parent, NoParamOrder noParamOrder = default, string field = null, string apps = null, int max = 100, string merge = null)

Parameters

parent ICanBeItem

The parent-item containing the content-blocks and providing edit-context

noParamOrder NoParamOrder

see Convention: Named Parameters

field string

Required: Field containing the content-blocks.

apps string

BETA / WIP

max int

BETA / WIP

merge string

Optional: html-text containing special placeholders.

Returns

IRawHtmlString

Remarks

  • Changed result object to IRawHtmlString in v16.02 from IHybridHtmlString

Module(int, int, NoParamOrder, object)

Get a 2sxc module rendered directly.

IRenderResult Module(int pageId, int moduleId, NoParamOrder noParamOrder = default, object data = null)

Parameters

pageId int
moduleId int
noParamOrder NoParamOrder

see Convention: Named Parameters

data object

Data to give the Razor as DynamicModel - new 15.07

Returns

IRenderResult

An HTML-String which can be added to the output directly. The object also has additional information like assets or page changes, which are not applied when using this render command.

Remarks

New in 2sxc 13.02

One(ICanBeItem, NoParamOrder, ICanBeEntity, object, string, Guid?)

Render one content block This is accessed through DynamicEntity.Render() At the moment it MUST stay internal, as it's not clear what API we want to surface

IRawHtmlString One(ICanBeItem parent, NoParamOrder noParamOrder = default, ICanBeEntity item = null, object data = null, string field = null, Guid? newGuid = null)

Parameters

parent ICanBeItem

The parent-item containing the content-blocks and providing edit-context

noParamOrder NoParamOrder

see Convention: Named Parameters

item ICanBeEntity

The content-block item to render. Optional, by default the same item is used as the context.

data object

Data to give the Razor as DynamicModel - new 15.07

field string

Optional:

newGuid Guid?

Internal: this is the guid given to the item when being created in this block. Important for the inner-content functionality to work.

Returns

IRawHtmlString

Remarks

  • Changed result object to IRawHtmlString in v16.02 from IHybridHtmlString