Interface IRenderService
Service on Kit.Render to rendering blocks and delivering HTML for the output.
[PublicApi]
public interface IRenderService
Remarks
It's used for InnerContent, so that Razor-Code can easily render additional content blocks.
You can also use it inside Skins/Themes to render content-blocks.
See also Inner Content (Content Within Other Content)
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
parentICanBeItemThe parent-item containing the content-blocks and providing edit-context
noParamOrderNoParamOrderfieldstringRequired: Field containing the content-blocks.
appsstringBETA / WIP
maxintBETA / WIP
mergestringOptional: html-text containing special placeholders.
Returns
- IRawHtmlString
Remarks
- Changed result object to
IRawHtmlStringin v16.02 fromIHybridHtmlString
Module(int, int, NoParamOrder, object?)
Get a 2sxc module rendered directly.
IRenderResult Module(int pageId, int moduleId, NoParamOrder noParamOrder = default, object? data = null)
Parameters
pageIdintmoduleIdintnoParamOrderNoParamOrderdataobjectData 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
parentICanBeItemThe parent-item containing the content-blocks and providing edit-context
noParamOrderNoParamOrderitemICanBeEntityThe content-block item to render. Optional, by default the same item is used as the context.
dataobjectData to give the Razor as
DynamicModel- new 15.07fieldstringOptional:
newGuidGuid?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
IRawHtmlStringin v16.02 fromIHybridHtmlString