orchardcmsorchardcms-1.7orchard-modules

How to Import Widgets | Orchard CMS


While mporting the Content/Metadata from ORchard CMS 1.9.1 to earlier version 1.7, whenever I export the Widgets, There is an error thrown as seen below:

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 20:                 @if (count > 0) {
Line 21:                     int i = 0;
Line 22:                     foreach (WidgetPart widget in widgets.Where(w => w.Zone == zone).OrderBy(w => w.Position, new Orchard.UI.FlatPositionComparer())) {
Line 23:                         <li class="widgets-@(widget.LayerId == Model.CurrentLayer.Id ? "this" : "other")-layer widgets-layer-@widget.LayerId@(i == 0 ? " first" : (i == count ? " last" : ""))">
Line 24:                             @using (Html.BeginFormAntiForgeryPost()) {


Source File: e:\inetpub\wwwroot\TestWebsite\Modules\Orchard.Widgets\Views\WidgetPlacement.Zones.cshtml    Line: 22 

whenever i export any of my widgets this error happens. Can you please help me understand the stepss to export Widgets ? What else i need to export before exporting Widgets ?


Solution

  • It could either be that the export from 1.9.1 is not compatible with 1.7, you'd have to compare your export from 1.9.1 and an export from 1.7, see what is different.

    Or, you could be importing widgets onto a layer that does not exist yet, which also will throw an error when you load the widgets management page.