This project is read-only.

Paperclip - Allow Changing Placement

Jul 9, 2011 at 4:36 PM

Hi Pete

Could you give just a hint how I can use the "Allow Changing Placement" feature

I need to change the order of the clips in the aside zone dynamically. 

I tried to do it in OnGetDisplayShape handler but failed.

Jul 9, 2011 at 9:41 PM

Implemented SocketHandler so far so good....

Jul 12, 2011 at 3:32 PM

SocketHandler is the manual way to control a lot of things right now. You can add custom filter classes in the Filtering handler, to manually filter and sort the query. The "Allow Changing Placement" feature still doesn't work, I might try and get it functioning in a rudimentary fashion for the v1 release, but there are questions such as what to do with the socket header that would normally be displayed. Let me know how you get on.

Jul 12, 2011 at 4:21 PM

In my theme I use it this way and it suites me fully.

  public class SocketsPartHandler : SocketHandler
    {
        IWorkContextAccessor wc = null;
        public SocketsPartHandler(IWorkContextAccessor workContextAccessor) {
            wc = workContextAccessor;
        }

      protected override void Preparing(SocketDisplayContext context) {
            if (context.DisplayType == "Detail") {
                var clipPart = context.ConnectorDefinition.Parts.FirstOrDefault(p => p.PartDefinition.Name == "PaperclipPart");
                if (clipPart != null) {

                    if (wc.GetContext().Layout.IsHomepage) {
                        var placment = context.LayoutPlacement;

                        switch (context.ConnectorType) {

                            case "PageForClient":
                                placment = "TripelSecond:10";
                                break;

                        }
                        context.LayoutPlacement = placment;

                    }
                }
            }
        }

Jul 12, 2011 at 4:49 PM

Great - I put those hooks in because a lot of the time it's much easier to just write some custom logic, rather than trying to cover every possible scenario in the settings. This is the exactly the kind of thing I was thinking of. I just need better documentation for SocketHandler and ConnectorHandler :)