Layout Filter

Topics: Customizing Orchard, General
Dec 4, 2014 at 2:07 PM

I really like Layouts and want to migrate some pages using BodyPart to Layout with HTML element, but I was using a custom IHtmlFilter implementation to replace tokens in it. How can I use tokens in HTML element? I enabled ElementToken from Layout but don't know how it Works.

Thanks in advance for your help,
Dec 4, 2014 at 2:23 PM
I answer myself.
  1. Copy Element-Content-Html.cshtml to your template.
  2. Add a tokenizer: var tokenizer = WorkContext.Resolve<ITokenizer>();
  3. Use it to render text: @Html.Raw(tokenizer.Replace(text,null))
Hope this help someone.