public override void Init(TagHelperContext context) { base.Init(context); FormGroupContext = context.GetFormGroupContext(); FormContext = context.GetFormContext(); if (FormGroupContext != null) { var formGroupContextClone = FormGroupContext.Clone(); context.SetFormGroupContext(formGroupContextClone); formGroupContextClone.ControlSize=BootstrapTagHelpers.Size.Default; if (FormGroupContext.FormContext != null) { formGroupContextClone.FormContext.ControlSize=BootstrapTagHelpers.Size.Default; context.SetFormContext(formGroupContextClone.FormContext); } } else if (FormContext != null) { FormTagHelper formTagHelperClone = FormContext.Clone(); context.SetFormContext(formTagHelperClone); formTagHelperClone.ControlSize=BootstrapTagHelpers.Size.Default; } if (Size == null) { var size = FormGroupContext?.ControlSize ?? FormContext?.ControlSize; if (size != null) Size = size == BootstrapTagHelpers.Size.Large ? SimpleSize.Large : SimpleSize.Small; } }
public override void Init(TagHelperContext context) { base.Init(context); FormContext = context.GetFormContext(); FormGroupContext = context.GetFormGroupContext(); if (FormContext != null) context.SetFormContext(new FormTagHelper { LabelWidthLg = FormContext.LabelWidthLg, LabelWidthMd = FormContext.LabelWidthMd, LabelWidthSm = FormContext.LabelWidthSm, LabelWidthXs = FormContext.LabelWidthXs, FormGroupSize = FormContext.FormGroupSize, Horizontal = false, Inline = FormContext.Inline, ControlSize = FormContext.ControlSize, LabelsSrOnly = FormContext.LabelsSrOnly }); if (FormGroupContext != null) context.SetFormGroupContext(new FormGroupTagHelper { FormContext = context.GetFormContext(), Size = FormGroupContext.Size, ControlSize = FormGroupContext.ControlSize, HasFeedback = FormGroupContext.HasFeedback, HasLabel = FormGroupContext.HasLabel, LabelWidthLg = FormGroupContext.LabelWidthLg, LabelWidthMd = FormGroupContext.LabelWidthMd, LabelWidthXs = FormGroupContext.LabelWidthXs, LabelWidthSm = FormGroupContext.LabelWidthSm, ValidationContext = FormGroupContext.ValidationContext }); }
public override void Init(TagHelperContext context) { base.Init(context); FormContext = context.HasFormContext() ? context.GetFormContext() : new FormTagHelper(); context.SetFormContext(new FormTagHelper { ControlSize = ControlSize ?? FormContext.ControlSize, Output = FormContext.Output, Inline = FormContext.Inline, Horizontal = FormContext.Horizontal, LabelWidthXs = FormContext.LabelWidthXs, LabelWidthLg = LabelWidthLg ?? FormContext.LabelWidthLg, LabelWidthMd = LabelWidthMd ?? FormContext.LabelWidthMd, LabelWidthSm = LabelWidthSm ?? FormContext.LabelWidthSm, LabelsSrOnly = FormContext.LabelsSrOnly }); context.SetFormGroupContext(this); Size = Size ?? FormContext.FormGroupSize; }