protected override void OnStart(TextWriter writer) { // Make sure we're in a PanelHeading if (GetComponent <PanelHeading>() == null) { GetHelper().PanelHeading().Component.Start(writer); } Panel panel = GetComponent <Panel>(); if (panel != null && panel.Collapsible) { ComponentBuilder <BootstrapConfig, Link> link = GetHelper() .Link(TextContent, $"#{panel.Id}_collapse") .AddAttribute("data-toggle", "collapse"); PanelGroup panelGroup = GetComponent <PanelGroup>(); if (panelGroup != null && panelGroup.Accordion) { link.AddAttribute("data-parent", $"#{panelGroup.Id}"); } AddChild(link); TextContent = null; } base.OnStart(writer); }
public static ComponentBuilder <TConfig, TTag> AddData <TConfig, TTag>(this ComponentBuilder <TConfig, TTag> builder, string name, string data) where TConfig : BootstrapConfig where TTag : Tag => builder.AddAttribute("data-" + name, data);