Custom form element view in Optimizely CMS 12
Ever wondered how to add a custom view for an Optimizely Forms form element in Optimizely CMS 12? You could have a look at this 7 year old article, but it's a somewhat outdated.
Step 1 - get yourself a view
- Locate the view you want to replace in the folder
/Views/ElementBlocks/
inside/modules/_protected/EPiServer.Forms/EPiServer.Forms.zip
- Copy the view to your solution. (For example, use the folder
/Views/ElementBlocks/
). - Make any changes you desire
Step 2 - use your view
- Add something like this to
ConfigureServices
instartup.cs
services.Configure<RazorViewEngineOptions>(o =>
{
o.ViewLocationFormats.Add("~/Views/ElementBlocks/{0}" + RazorViewEngine.ViewExtension);
});
That's it!
Found this post helpful? Help keep this blog ad-free by buying me a coffee! ☕