crosspost: https://orchard.codeplex.com/discussions/549374
I'm using Orchard 1.8, and I've built a part that I've attached to a widget. It's a basic part but I'm having issues rendering the template. Here's my code:
MODEL
public class AppsWidgetRecord : ContentPartRecord {
}
public class AppsWidgetPart : ContentPart<AppsWidgetRecord> {
}
DRIVER
public class AppsWidgetDriver : ContentPartDriver<AppsWidgetPart>
{
protected override DriverResult Display(AppsWidgetPart part, string displayType, dynamic shapeHelper)
{
return ContentShape("Parts_AppsWidget",
() => shapeHelper.Partial(
TemplateName: "Parts/AppsWidget"
));
}
}
I have an AppsWidget.cshtml under View/Parts
MIGRATION
#region Define Apps Widget
ContentDefinitionManager.AlterPartDefinition(
typeof(AppsWidgetPart).Name, cfg => cfg.Attachable());
ContentDefinitionManager.AlterTypeDefinition("AppsWidget", cfg => cfg
.WithPart("WidgetPart")
.WithPart(typeof(AppsWidgetPart).Name)
.WithPart("CommonPart")
.WithSetting("Stereotype", "Widget"));
#endregion
#region Create Apps Widget
var appsWidget = _widgetsService.CreateWidget(homepageLayer.Id, "AppsWidget", "Apps", "5", "AfterContent");
appsWidget.RenderTitle = true;
appsWidget.Name = "apps";
_contentManager.Publish(appsWidget.ContentItem);
#endregion
PLACEMENT
<Place Parts_AppsWidget="AfterContent:5" />
The widget renders fine, the template of the part however, does not render at all. When I shape trace, the appswidgetpart is nowhere to be seen under the widget, but when I check the model it is there.
I've also debugged and attached to the display function within the driver, and no issues come about. I don't see any errors in the logs as well.
Any ideas?