Is there a content part attached to types by default?

Topics: Core, Writing modules
Jan 11, 2012 at 11:55 PM

Is there a content part that no matter what gets attached to all content types, so we can safely assume that a content type will always have this content part? CommonPart is a good candidate for this but I know it does not get automatically attached. So is there such a part?

Jan 11, 2012 at 11:57 PM

Common is the closest thing but it is not on all types. Why do you need that?

Jan 12, 2012 at 12:32 AM
Edited Jan 12, 2012 at 12:33 AM

Thanks, that's what I thought. I'd like to specify content types to "observe" (meaning subscribe to their events, like OnRemoved). It seems that the easiest way to do that is to define a simple content part, attach it to the types and subscribe to its events in a handler (and do whatever have to be done if the event happens with its containing content type),

Jan 12, 2012 at 12:34 AM

Content Rules are doing that already.

Jan 12, 2012 at 12:47 AM

Ah, of course. Rules is not in my mind yet. Thanks!

Jan 12, 2012 at 1:45 AM

Also you don't need a part. You can just override the non-generic methods of ContentHandler, or implement a ContentDriver (without the <T>).

Jan 12, 2012 at 7:42 PM

Thanks, that's even more straightforward. I don't know how I haven't thought about that too :-).