Need Help Creating Content Part

Oct 28, 2010 at 6:36 AM
Edited Oct 28, 2010 at 7:13 AM

I'm stuck at writing a driver on this doc. Orchard.Core.ContentsLocation doesn't exist and part.GetLocation doesn't exist...
Can anyone fix the driver code below so it works with v0.8? I can't wait for this document to be updated. It's been outdated for quite some time...

Thanks in advance.

(Update: I'm now trying learn this by looking at other modules from Orchard source. Is there a better way to learn? Any suggestions?)

using Maps.Models;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;

namespace Maps.Drivers
    public class MapDriver : ContentItemDriver
        protected override DriverResult Display(MapPart part, string displayType)
            return ContentPartTemplate(part, "Map").Location(part.GetLocation(displayType));

        protected override DriverResult Editor(MapPart part)
            return ContentPartTemplate(part, "Map").Location(part.GetLocation("Editor"));
        protected override DriverResult Editor(MapPart part, IUpdateModel updater)
            updater.TryUpdateModel(part, Prefix, null, null);
            return Editor(part);
Oct 28, 2010 at 5:13 PM

Working on it. It's been updated since Monday, yes ;)

Nov 4, 2010 at 2:57 PM


You should update the documentation as well. That example gets the same error when the Driver tries to compile.


Nov 4, 2010 at 3:31 PM

Absolutely: all the documentation is being updated but it takes time. Thanks for your patience.

Dec 19, 2010 at 4:56 PM

I am having trouble getting Maps to show up as a Content Part.  I followed the documentation (notes below to help with updating the docs), and all seems to work well.  The application builds, and I can enable Maps.  However, when I try to add Maps to a content item, Maps is not in the list of parts.  Also, Maps is not shown in the content partsd listing (/Admin/ContentTypes/ListParts).

I tried adding the ContentDefinitiionManager line in Migrations to make the part attachable, cleared the cache files and rebuilt the solution, but Maps was still not found in hte content parts.  Feels like I'm close but missing a piece.  Any clue?

Documentation Notes

Downloading and building version 0.9 (default branch, rev 3998)

Writing a content part

1. Module.txt
  a.  the codegen'd Module.txt has versions set to 0.5.0 instead of 1.0.0 or 0.9.0 - trivial, I know, but if we're making notes, let's make notes.

2. DataMigrations.cs
  a. the codegen creates a class called Migrations rather than MapsDataMigrations.
  b. the codegen for DataMigrations.cs does not insert the line ContentDefinitionManager... .Attachable line.

3. Content Parts
  a. After enabling Maps, Maps does not appear in Content Parts that can be attached to Content Items
  b. Maps also does not apear in hte listing of content parts (/Admin/ContentTypes/ListParts).


Dec 21, 2010 at 9:56 PM

I think it has to do with the file. I've already updated and verified but I will also verify the one about parts.

Dec 22, 2010 at 3:23 AM

The Map part tutorial is also updated.

Dec 22, 2010 at 12:00 PM

Had to clear App_Data, and a couple of other tweaks noted in the update doc, but it works.  Thanks.