Display/Edit methods not getting hit for a custom part driver

Topics: Writing modules
May 15, 2012 at 7:01 PM

I have a custom part driver, that I attached to another Content Type. But when that content gets rendered, my custom part doesn't get displayed. I see it in shape tracer as one of the welded parts.

Upon debugging, I found that the methods, Display/Editor in the driver for my custom part are not getting hit.

How do I resolve this issue?

Coordinator
May 15, 2012 at 7:31 PM

Placement?

May 15, 2012 at 7:34 PM

I have the placement file in place. Also, doesn't the placement come into picture later when the view has to actually render. But, before that driver methods should be hit. Am I correct with the above statement?

Coordinator
May 15, 2012 at 8:05 PM

Yes.

Is the feature enabled?

May 15, 2012 at 8:31 PM
bertrandleroy wrote:

Yes.

Is the feature enabled?

I assume you meant module enabled and yes my module is enabled.

May 15, 2012 at 9:21 PM

Any thoughts anyone. Please help. I am stuck !

Thanks

Developer
May 15, 2012 at 10:04 PM

Please post the code of your driver?

Coordinator
May 16, 2012 at 6:19 AM

I meant feature. Modules have features. You enable features, not modules. Anything in app_data\logs? Seeing the code for the driver would help too.

May 16, 2012 at 3:48 PM

I don't see any error associated to my module in App_data\logs.

Here is the code for my driver -

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using PAC.ADInterface.Models;
using Orchard;

namespace PAC.ADInterface.Drivers
{
    public class UserActiveDirectoryInfoPartDriver : ContentPartDriver
    {
        private readonly IContentManager _contentManager;
        private readonly IOrchardServices _services;

        public UserActiveDirectoryInfoPartDriver(
            IContentManager contentManager, IOrchardServices services)
        {
            _contentManager = contentManager;
            _services = services;
        }

        protected override DriverResult Display(UserActiveDirectoryInfoPart part, string displayType, dynamic shapeHelper)
        {
            return ContentShape("Parts_UserActiveDirectoryInfo",
                                  () => shapeHelper.Parts_UserActiveDirectoryInfo());
        }

        protected override DriverResult Editor(UserActiveDirectoryInfoPart part, dynamic shapeHelper)
        {
            return ContentShape("Parts_UserActiveDirectoryInfo_Edit",
                                () => shapeHelper.Parts_UserActiveDirectoryInfo_Edit());
        }

        protected override DriverResult Editor(UserActiveDirectoryInfoPart part, IUpdateModel updater, dynamic shapeHelper)
        {
            return Editor(part, shapeHelper);
        }
    }
}

May 16, 2012 at 4:17 PM

I rewrote the same stuff in a new module and it works now.

Thanks everyone for looking into it.

May 16, 2012 at 4:26 PM

In your new module, is the row:

public class UserActiveDirectoryInfoPartDriver : ContentPartDriver

replaced by

public class UserActiveDirectoryInfoPartDriver : ContentPartDriver<UserActiveDirectoryInfoPart>

Because it seems like that's whats missing.

May 16, 2012 at 5:13 PM
JLedel wrote:

In your new module, is the row:

public class UserActiveDirectoryInfoPartDriver : ContentPartDriver

replaced by

public class UserActiveDirectoryInfoPartDriver : ContentPartDriver<UserActiveDirectoryInfoPart>

Because it seems like that's whats missing.

It was there in older module too. I don't know why it didn't get pasted.