private static MvcForm GenerateForm(this HtmlHelper htmlHelper, string formAction, FormMethod method, IDictionary<string, object> htmlAttributes, FormLayout layout)
{
var tagBuilder = new TagBuilder("form");
tagBuilder.MergeAttributes(htmlAttributes);
tagBuilder.MergeAttribute("action", formAction);
tagBuilder.MergeAttribute("method", HtmlHelper.GetFormMethodString(method), true);
if (layout != FormLayout.Default)
tagBuilder.AddCssClass("form-" + layout.ToString().ToLower());
htmlHelper.ViewContext.TempData["BootstrapFormLayout"] = layout;
var flag = htmlHelper.ViewContext.ClientValidationEnabled && !htmlHelper.ViewContext.UnobtrusiveJavaScriptEnabled;
if (flag) tagBuilder.GenerateId(GenerateId(htmlHelper.ViewContext));
htmlHelper.ViewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.StartTag));
var mvcForm = new MvcForm(htmlHelper.ViewContext);
if (flag) htmlHelper.ViewContext.FormContext.FormId = tagBuilder.Attributes["id"];
return mvcForm;
}