No, there is nothing out of the box, but a sc_formmode
url parameter is present whenever you are in Form Builder mode. The value is new
or edit
depending on the context, but just checking for the presence of the parameter is sufficient.
You can create an extension method to make this more reusable:
using Sitecore.Mvc.Helpers;
namespace MyCustom.Forms.Feature.ExperienceForms.Extensions
{
public static class HtmlHelperExtensions
{
public static bool IsExperienceForms(this SitecoreHelper helper)
{
return Sitecore.Context.Request.QueryString["sc_formmode"] != null;
}
}
}
In your views you can then detect the mode and render your markup as required:
@if (Html.Sitecore().IsExperienceForms())
{
@* render Forms Builder mode *@
}
else
{
@* render normal view *@
}
You can read more in this blog post by Joao Neto.