Ejemplo n.º 1
0
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            base.InitProcess(output);

            var childContent = await output.GetChildContentAsync();

            var parentId = context.Items[AccordionTagHelper.ParentIdKey] as string;

            var localId = Lorem.StringId();
            var content = new StringBuilder();

            content.AppendLine($@"
<div class=""card-header"">
    <{HeadingTag} class=""mb-0"">
        <button class=""btn btn-link"" type=""button"" data-toggle=""collapse"" data-target=""#{localId}"">
            { Title}
        </button>
    </{HeadingTag}>
</div>
<div id=""{localId}"" class=""collapse { (Active ? "show" : "")}"" data-parent=""#{parentId}"">
    <div class=""card-body"">
        {childContent.GetContent()}
    </div>
</div>
");
            output.Content.SetHtmlContent(content.ToString());
        }