Interface ICmsModule
Information about the module context the code is running in.
🪒 In Dynamic Razor it's found on CmsContext.Module
🪒 In Typed Razor it's found on MyContext.Module
[PublicApi]
public interface ICmsModule : IHasMetadata
- Inherited Members
Remarks
Note that the module context is the module for which the code is currently running. In some scenarios (like Web-API scenarios) the code is running for this module but not on this module, as it would then be running on a WebApi.
Properties
Block
Information about the root block in the module.
ICmsBlock Block { get; }
Property Value
Remarks
Added ca. v13, but not documented/published till 2sxc 17.
Id
The module id on the page.
🪒 Use in Dynamic Razor: CmsContext.Module.Id
🪒 Use in Typed Razor: MyContext.Module.Id
Tip
This Module ID is often used to give DOM elements a unique name.
For example: id="my-app-wrapper-@CmsContext.Module.Id"
.
But since v16.04 there is a new property UniqueKey
which is better suited for this.
int Id { get; }
Property Value
- int
The ID, unless unknown, in which case it's a negative number
Remarks
Corresponds to the Dnn ModuleId or the Oqtane Module Id.
In some systems a module can be re-used on multiple pages, and possibly have different settings for re-used modules. 2sxc doesn't use that, so the module id corresponds to the Dnn ModuleId and not the PageModuleId.