Orchardcore: Rendering of Widget ContentItem containing Bag throws exception

Created on 23 Sep 2019  路  7Comments  路  Source: OrchardCMS/OrchardCore

Error while rendering "widget" content item containing Bag Part.
An unhandled exception occurred while processing the request. Exception: Shape type 'Widget_Summary' not found OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context) in DefaultHtmlDisplay.cs, line 125
To reproduce,

  1. Create a widget content type "News"
  2. Create a widget content type "News Roll", Add Bag Part and select "Contained Content Types" News.
  3. Create New "News Roll" publish and click View.

Default display type should be Detail if display type is null

https://github.com/OrchardCMS/OrchardCore/blob/f832db952faf5c55e7f1d43ef74226214675dc88/src/OrchardCore.Modules/OrchardCore.Flows/Views/BagPart.cshtml#L9

Widgets bug

Most helpful comment

I had the same bug, you can mitigate by implementing in your theme:

Shape name: BagPart

{% for item in Model.BagPart.ContentItems %}
{{ item | shape_build_display | shape_render }}
{% endfor %}

All 7 comments

I had the same bug, you can mitigate by implementing in your theme:

Shape name: BagPart

{% for item in Model.BagPart.ContentItems %}
{{ item | shape_build_display | shape_render }}
{% endfor %}

@jptissot can you provide a fix as a PR if you agree with the change? I would take it for rc, seems low risk and an easy bug to get into

The other fix for this is just the set the display type you want, i.e. Detail in the BagPartSettings.

Probably we could consider a WidgetSummary shape, otherwise changing the default might affect all the other BagPart default displays

We can adda Summray template that has the same content as the DEtails one. @deanmarcussen you want to do it?

@deanmarcussen BagPart uses BagPartSettings but it fallback to "Summary" only in event of null that resulted in this exception.

I鈥檓 not near the computer tonight so if someone else can?

I will then.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aghili371 picture aghili371  路  3Comments

randaratceridian picture randaratceridian  路  3Comments

khoshroomahdi picture khoshroomahdi  路  4Comments

deanmarcussen picture deanmarcussen  路  3Comments

jardg picture jardg  路  3Comments