This project is read-only.

Editor shape not displaying

Topics: Writing modules
Jul 27, 2011 at 4:00 PM

I have an editor shape that I can't seem to get to display.  I've gotten this to work before, but for some reason in this instance it's not working.  After enabling, I attached the RelatedContentSettingsPart to the Page content type and attempted to edit a page.  I don't see the view get rendered on the edit page.  When I set a breakpoint in the driver's editor method, it hits it, and it steps over the return statement correctly, so it seems its all running correctly, but it's just not displaying the template/view.  I have looked over this code enough that I don't see what's wrong with it. I  looked into messing with the placement file, but I didn't get anywhere with that.



public int Create()
            // Creating table MapRecord
            SchemaBuilder.CreateTable("RelatedContentRecord", table => table

                typeof(RelatedContentPart).Name, cfg => cfg.Attachable());

            // Create a new widget content
            ContentDefinitionManager.AlterTypeDefinition("RelatedContentWidget", cfg => cfg
                .WithSetting("Stereotype", "Widget"));

            // Settings for the related content widget
            SchemaBuilder.CreateTable("RelatedContentSettingsRecord", table => table

                typeof(RelatedContentSettingsPart).Name, cfg => cfg.Attachable());

            return 1;



Driver (Drivers/RelatedContentSettingsDriver.cs)

public class RelatedContentSettingsDriver : ContentPartDriver<RelatedContentSettingsPart>
        protected override DriverResult Editor(
              RelatedContentSettingsPart part, dynamic shapeHelper)
            return ContentShape("Parts_RelatedContentSettings_Edit",
                () => shapeHelper.EditorTemplate(
                    TemplateName: "Parts/RelatedContentSettings",
                    Model: part,
                    Prefix: Prefix));

        protected override DriverResult Editor(
            RelatedContentSettingsPart part, IUpdateModel updater, dynamic shapeHelper)

            updater.TryUpdateModel(part, Prefix, null, null);
            return Editor(part, shapeHelper);

View (views/editortemplates/parts/RelatedContentSettings.cshtml) 

<h1>Settings for the Related Content Widget</h1>
Jul 27, 2011 at 9:19 PM

Missing placement?

Jul 28, 2011 at 2:21 PM

Yeah, that was it. I have to remember that by default (no placement entry) a part will not display.  Thanks for playing, Bertrand :)