我在 Sitecore 中有一个自定义字段 - 一个带有数字和富文本编辑器的复合字段。
编辑器方面工作得很好,但是当没有页面编辑器呈现该字段时,我想将它的格式委托给一个 cshtml 文件 - 发送一个我选择的对象作为模型。
我可以在 DoRender 中截取渲染:
protected override void DoRender(HtmlTextWriter output)
{
if (!Sitecore.Context.PageMode.IsPageEditor)
{
//here is where I want to delegate the output to a cshtml DisplayTemplate with the Value as the Model.
}
else
{
base.DoRender(output);
}
}
但是,如何将输出委托给以值作为模型的 cshtml DisplayTemplate?