This project is read-only.

Additional constraints on Attachable

Dec 12, 2010 at 7:56 AM


Is it possible to add additional constraints on Attachable content parts somehow? I mean eg. to specify Content Parts which are required before my part can be attached, and detaching of whose causes my part to detach/deactivate until the requirements are met. Maybe handler events would be helpful with achieving that functionality, because there is no such thing when creating data migrations?

An example to clarify. I'm building a part adding "I like it/Digg it/etc." functionality, and it should only be attachable to types having RoutePart (what is rather obvious).

Cheers, Piotr

Dec 12, 2010 at 8:02 AM

I know that it can be done by doing a check in the driver Display method and just displaying nothing if eg. current item is not castable to RoutePart, but that's just an ugly workaround.

Dec 12, 2010 at 9:19 AM

You can always cast the content item to a specific part but parts are supposed to be standalone. Actually, not being routable doesn't mean the content item can't be reached. Look at the view button in the content item list.

Dec 12, 2010 at 2:11 PM

Ok, you got me:) I actually haven't tried it yet, but thought to work as a workaround - I'm starting to work on this now. Thanks for clarifying that it won't work this way so I have to find another solution.

The main question is still open - how to make a content part attachable only to type with specific parts ie. how to put additional requirements/constraints on attachable content part?