4

Resolved

Widgets (NOT) missing CommonPart

description

In the latest 1.x. / soon-to-be-1.8. / 0184cd235fe9b51203197864e2bf95c5e297951c

in the /Admin/Widgets there is a big warning:
__
Widgets with problems.

These widgets aren't going to appear anywhere because they're missing the CommonPart from their content type. To fix these widgets, if you still want to keep them around, start by fixing their Content Types.

following the list of all widgets.
...
__

However, below there is a list of widgets assigned to layers and the frontent also seems to display them...

Technically, there cannot be a widget without commonpart, and all of the widgets have it attached.

comments

jtkech wrote Dec 9, 2013 at 8:34 PM

In \Orchard.Widgets\Services\WidgetsService.cs there is a missing line (before line 58)

Replace:

public IEnumerable<WidgetPart> GetOrphanedWidgets() {
return _contentManager
    .Query<WidgetPart, WidgetPartRecord>()
    .List();
}

With:

public IEnumerable<WidgetPart> GetOrphanedWidgets() {
return _contentManager
    .Query<WidgetPart, WidgetPartRecord>()
    .Where<CommonPartRecord>(x => x.Container == null)
    .List();
}


Note: It's ok in 1.7.x

Thanks