Interface IRenderService
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)
Namespace: ToSic.Sxc.Services
Assembly: ToSic.Sxc.dll
Syntax
[PublicApi_Stable_ForUseInYourCode]
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
| Improve this Doc View SourceAll(ICanBeItem, string, string, string, int, string)
Render content-blocks into a larger html-block containing placeholders
Declaration
IRawHtmlString All(ICanBeItem parent, string noParamOrder = "Params must be named (https://go.2sxc.org/named-params)", string field = null, string apps = null, int max = 100, string merge = null)
Parameters
Type | Name | Description |
---|---|---|
ICanBeItem | parent | The parent-item containing the content-blocks and providing edit-context |
string | noParamOrder | |
string | field | Required: Field containing the content-blocks. |
string | apps | BETA / WIP |
int | max | BETA / WIP |
string | merge | Optional: html-text containing special placeholders. |
Returns
Type | Description |
---|---|
IRawHtmlString |
Remarks
- Changed result object to
IRawHtmlString
in v16.02 fromIHybridHtmlString
Module(int, int, string, object)
Get a 2sxc module rendered directly.
Declaration
IRenderResult Module(int pageId, int moduleId, string noParamOrder = "Params must be named (https://go.2sxc.org/named-params)", object data = null)
Parameters
Type | Name | Description |
---|---|---|
int | pageId | |
int | moduleId | |
string | noParamOrder | |
object | data | Data to give the Razor as |
Returns
Type | Description |
---|---|
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, string, 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
Declaration
IRawHtmlString One(ICanBeItem parent, string noParamOrder = "Params must be named (https://go.2sxc.org/named-params)", ICanBeEntity item = null, object data = null, string field = null, Guid? newGuid = null)
Parameters
Type | Name | Description |
---|---|---|
ICanBeItem | parent | The parent-item containing the content-blocks and providing edit-context |
string | noParamOrder | |
ICanBeEntity | item | The content-block item to render. Optional, by default the same item is used as the context. |
object | data | Data to give the Razor as |
string | field | Optional: |
Guid? | newGuid | Internal: this is the guid given to the item when being created in this block. Important for the inner-content functionality to work. |
Returns
Type | Description |
---|---|
IRawHtmlString |
Remarks
- Changed result object to
IRawHtmlString
in v16.02 fromIHybridHtmlString