Esempio n. 1
0
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            output.SetTagName("img");
            output.AddCssClass("media-object");

            output.TagMode = TagMode.SelfClosing;

            if (Href.IsNotNullOrEmpty())
            {
                TagBuilder link = new TagBuilder("a")
                {
                    TagRenderMode = TagRenderMode.Normal
                };
                link.MergeAttribute("href", Href);

                output.WrapOutside(link);
            }

            if (Height.IsNotNullOrEmpty())
            {
                output.AddCssStyle("height", Height);
            }

            if (Width.IsNotNullOrEmpty())
            {
                output.AddCssStyle("width", Width);
            }

            TagBuilder wrapper = new TagBuilder("div")
            {
                TagRenderMode = TagRenderMode.Normal
            };

            wrapper.AddCssClass(Align.GetEnumInfo().Name);

            output.WrapOutside(wrapper);
        }