Accessing "HTML Widget" Title

Topics: General
Jan 17, 2012 at 8:59 PM

The shape-tracer shows that an HTML Widget does not have a Parts_Title...or anything that looks like a title.  Nevertheless, it does have a title and can render it if supplied.  How do I get access to the title so that, for example, I could make it appear below the Parts_Common_Body?

I also tried adding an explicit Title part to the HTML Widget.  Orchard allowed me to add the title part, but when I then modified the properties of an HTML Widget (including the extra title), Orchard *tried* to give me an error message (I could see a read bar near the top of the screen, but it contained no text).  It would not let me save data with additional title information.

Coordinator
Jan 17, 2012 at 9:04 PM

The title is rendered by the wrapper.

Jan 17, 2012 at 9:09 PM

That would make sense, except that there are no wrappers specified for the HTML Widget.  The shape-tracer, in my case, indicates the two possible wrappers are:

~/Themes/MetalDarkGrey/Views/Widget.Wrapper.cshtml
~/Themes/MetalDarkGrey/Views/Widget.ControlWrapper.cshtml
Neither of those two wrappers exist (they have not been defined / there is no file at that path).
Is there some other "catch all" wrapper that I'm not seeing?  If so, why does the shape-tracer not reveal it?
Jan 17, 2012 at 9:47 PM

That's the primary location that the shape table will look, but it will look in all other modules as well. It actually exists in Orchard.Widgets\Views.

Jan 17, 2012 at 10:59 PM

Sure enough, I found Widget.Wrapper.cshtml which appears to render the title.  Now this has merely become a curiosity: why did the Orchard team choose to have this handled with a wrapper, rather than using a Content Part?

If the answer is "no particualr reason," that is ok.  Like I say, I'm just curious because I would not have expected a wrapper to have been the approach used for this.

Coordinator
Jan 18, 2012 at 2:09 AM

Because sometimes we make stupid decisions.

Jan 18, 2012 at 2:19 AM

You are hilarious.  Ok, bad decision - but you still have an amazing product.  I love Orchard!!!