As the title says, I need a way in a 2sxc module to detect whether it is the original module on a page or a copy of the module being rendered in the theme.
A little more information: I have a case where I am making a manager page for a flyout menu, and it needs to display on the page what the flyout will look like as well as render this module in the theme. I have found that to render the module in the theme I need to use this.GetScopedService<IRenderService>().Module()
, but the issue I am having is that I need to detect whether it is the original module on the page or the version being rendered in the theme through the IRenderService call as I need to add in some additional tags when it is the original to get it to display properly. Is there any way to check for this?
When you are rendering the module from the theme you can pass in Data. So when the module renders on the page, this data would be null. So simple add (or not add) to your output based on that. Might be as simple as (note: this is pseudo-code, I have not tried this)
...Module(pageId: 42, moduleId: 123, data: {})
and then
if (MyModel.Data is null)
{
// add stuffs
}
else
{
// don't add stuffs
}
This would also allow you to pass in settings or other stuff and do a variety of things differently from the theme vs. the "real" module output.