This project is read-only.

Which version/changeset/branch to use currently?

Feb 27, 2012 at 9:25 PM

Hi Pete,

I'm just planning to use Mechanics for connecting widgets to content types (not just content items; I guess this is possible?) as you advised in this discussion. I looked into implementing Widget editing for typepart settings but I think I don't want to deal with it :-), instead I'll use and advise the users of FB Suite to use your module for this task. The last release of SP was a long time ago, so what code should I use? If the requirements are solely what I described (i.e. connecting widgets to content types, e.g. for all blog posts) is the last release in the Gallery enough or should I use some of the source from here?


Feb 28, 2012 at 1:33 AM

The last release in the Gallery should technically be able to do it, however the latest versions will have massive improvements.

To be honest I'm a few days away from a final v1 release of Mechanics, coincidentally perfect timing with Orchard 1.4 release, which the current code requires.

The latest stuff is on the 'alchemy' branch (which will merge back to default this week).

Most of it is working really well now, including proper versioning of relationships, there is one slight bug with postback / persistence that I need to nail :) And I almost have Lens fully operational which will allow Ajax searching of items when creating connections.

Feb 28, 2012 at 8:57 AM

Thanks, the v1 release sounds great! I'll test with the current codebase today. Actually are content type-level connections simply possible (e.g. connecting a widget to all items of a specific type?) or only with code?

Feb 28, 2012 at 1:26 PM

Oh I see, no you can't do that, connections are all per item. My suggestion would be to implement a type editor that surfaces a link to create/edit the widget, then use a handler to check for the content type and render the widget in the zone where you want it.

Feb 28, 2012 at 9:06 PM
Edited Feb 28, 2012 at 9:09 PM

Thanks, I'll look into that.

Now I tried with the latest source, installed Mechanics (and Origami). This may be an RTFM issue, although I think I've done it right.

I've done the following:

  1. I attached SocketPart to Page.
  2. I created a new content type, "SocialPluginConnector" with ConnectorPart attached.
  3. Set "Allowed content (left)" to "Page" and "Allowed content (right)" to "FacebookCommentsBoxWidget,FacebookLikeButtonWidget" (BTW these text boxes could have some styling and be bigger like the class "textMedium").
  4. Created widgets of those two types on a new layer "Social Plugins" with the rule "false" (so they don't get displayed otherwise; setting to true does not solve the isse).
  5. SocialPluginConnector items get properly created.

But the connected widgets could not be seen. The title "SocialPluginConnectors" is there but the div with class socket-content below is empty. What have I done wrong?

Actually the way item connecting works (with the checkboxes) is just perfect, I'd have liked some enable/disable feature per content item either!

I see that the connectors title ("SocialPluginConnectors" here) is displayed on the admin summary too. I think a default to hide it (ant the items too) on SummaryAdmin would be better.

Feb 28, 2012 at 9:21 PM

I've opened issues for the textbox thing and for an exception.

Feb 29, 2012 at 5:49 PM

Thanks; it's probably a bug due to Stereotype=="Widget", a couple of things behave differently in rendering as a result and I haven't tested widgets lately. Will look into it.

Can you say in more detail what you mean by "enable/disable feature"? What exactly do you want to disable?

You can hide sockets from by using:

<Place Socket-SocialPluginConnector="-" />

<Place Socket_Edit-SocialPluginConnector="-" />

(You can do masses of stuff in Placement, check out Cartography's Also have a look at shape tracing in the front end, there are many nested levels of shapes which all support placement. IMO this is better than having tons of options in Admin, which is why I've tried to keep it minimal.)

Also, the title should automatically hide in most cases when there are no connected items, but it's not working for some reason.

Feb 29, 2012 at 7:54 PM

Thanks! I'll also dive a bit into the code to see whether this has to do with anything on my end.

By "some enable/disable feature per content item" I've meant that when I originally wanted to attach widgets to content types I wanted an option to enable/disable the widgets per content item; just as with Comments. Now the checkbox-selection of connections pretty much does that too, that's why I'm happy with it (maybe that sentence of mine was wrongly formulated: I like this feature!).

Will check out that too.

Mar 5, 2012 at 12:29 AM

I've see you pushed some changes, I guess 0134e082ced8 addresses that the connectors title is rendered even if there are no connection?

BTW have you got my e-mail reply?