HTML Widget

Topics: General
Mar 27, 2011 at 4:16 PM

1) Am I correct in understanding a HTML Widget to be a Content Type?

(I come to this conclusion since in the Dashboard it shows up under Manage Content Types)

If I edit the HTML Widget Content Type, I see it is comprised of the following Parts:

Widget, Body & Common

2) Does this mean that Widget is a part that can be added to a Content Type?

3) Why when I create a new Content Item in the Dashboard and click on the Add button isn't Widget listed as an available Part?

Mar 27, 2011 at 6:07 PM

I was nearly going to mention this in your other thread; Widgets are also Content Types.

In Orchard.Blogs.Migrations:

            ContentDefinitionManager.AlterTypeDefinition("RecentBlogPosts",
                cfg => cfg
                    .WithPart("RecentBlogPostsPart")
                    .WithPart("CommonPart")
                    .WithPart("WidgetPart")
                    .WithSetting("Stereotype", "Widget")
                );

So you see, the WidgetPart can be added from code, but like BlogPart etc. it's not Attachable so you can't use it yourself in the Dashboard.

Mar 27, 2011 at 6:57 PM

"I was nearly going to mention this in your other thread; Widgets are also Content Types."

So by definition is every Part a Content Type?

Mar 27, 2011 at 7:24 PM

No; a Content Type is composed of many Parts. Parts themselves aren't Content Types.

A Widget is a Content Type that has the Widget Part in its composition.

Mar 27, 2011 at 9:34 PM
randompete wrote:

No; a Content Type is composed of many Parts. Parts themselves aren't Content Types.

A Widget is a Content Type that has the Widget Part in its composition.

Am I correct in assuming then that as Orchard has evolved at times people played fast and loose with naming conventions?

For example, Recent Blog Posts is a is a Content Type that includes a Widget in it's Parts, so perhaps could it be better named a Recent Blog Posts Widget?

Also the Content Type Recent Blog Posts has a Part named Recent Blog Posts, would that Part be more aptly named Recent Blog Posts Part?

So we would end up with: The content item Recent Blog Posts Widget includes in its Parts the Recent Blog Posts Part; which would then make it clear that a Recent Blog Posts Widget is not the same as a Recent Blog Posts Part??


Mar 27, 2011 at 10:21 PM

If you look at the code I quoted from Blogs module, it says

.WithPart("RecentBlogPostsPart")

So indeed the "RecentBlogPostsPart" is called "RecentBlogPostsPart". I don't think I'm seeing any inconsistency. Part names all end in "Part". When they're displayed in the Dashboard UI, the "Part" suffix is omitted, because well we're in the "Parts" screen so it's kind of obvious they're parts. Similarly when I go to Widgets, there's no need to have "Widget" on the end of anything. Content Types have no particular naming convention, for widgets or otherwise.

Perhaps on the Content Types screen there could be an icon or just some text for each type that said either Widget, Content, or Other so you could quickly see which was which. Or maybe split into three groups.

Mar 27, 2011 at 10:30 PM
randompete wrote:

If you look at the code I quoted from Blogs module, it says

 

.WithPart("RecentBlogPostsPart")

So indeed the "RecentBlogPostsPart" is called "RecentBlogPostsPart". I don't think I'm seeing any inconsistency. Part names all end in "Part". When they're displayed in the Dashboard UI, the "Part" suffix is omitted, because well we're in the "Parts" screen so it's kind of obvious they're parts. Similarly when I go to Widgets, there's no need to have "Widget" on the end of anything. Content Types have no particular naming convention, for widgets or otherwise.

 

Perhaps on the Content Types screen there could be an icon or just some text for each type that said either Widget, Content, or Other so you could quickly see which was which. Or maybe split into three groups.

Well yes and no ;-)

In the Dashboard UI (1.0.20) if you click on Widgets under Available Widgets yo will see some listed with the Widget suffix and some without.

Example:

Available Widgets

Name
ContainerWidget Add to zone
HtmlWidget Add to zone
RecentBlogPosts Add to zone
BlogArchives Add to zone
SearchForm Add to zone
SilverlightWidget Add to zone
BreadcrumbsWidget Add to zone
MenuWidget Add to zone
RecentlySeenWidget Add to zone
Mar 27, 2011 at 10:59 PM

You're right, that does look a bit odd. But I guess the single-word widgets would look strange without explicitly using the word Widget - whereas the ones without are slightly more self-explanatory. I mean, a SearchForm is a SearchForm. But what is a "Silverlight"? In that case, the word Widget is needed for it to make sense.

Anyway, someone who knows more than me should probably comment :)

Coordinator
Mar 29, 2011 at 1:43 AM

If you think it needs to be fixed, fit it ;)