Question: Why does Orchard.Layouts "CreateElementTagBuilder" discard Attributes of the shape?

Topics: Writing modules
Aug 26, 2015 at 6:55 PM
The behavior of Orchard's standard TagBuilder (ITagBuilderFactory) is to merge in all the attributes of the Attributes dictionary on the shape, then attach CSS And ID. So any Shape Table provider can jump in and add HTML attributes to a shape that would be passed in to a tag builder.

However, the CreateElementTagBuilder of Orchard.Layouts discards the attributes completely and only adds CSS, inline styles, and ID.

I was wondering why these is a difference here, as I wanted to add some custom Attributes to existing Element tags using IElementEventHandler.

Is there a reason this isn't allowed? Otherwise I'd like to enable this and submit a patch.
Aug 26, 2015 at 7:13 PM
It should be allowed, and looking at the code, it should work fine when using the CreateElementTagBuilder method. However, I did notice that the GetCommonElementAttributes method does not merge with existing attributes, so maybe you'd want to create a GitHub issue for that and provide a patch, that would be cool. Thanks.
Aug 26, 2015 at 7:48 PM
Cool, I'll do that.
Aug 26, 2015 at 7:52 PM

Thanks for the quick reply, Sipke =D