Is there a content part attached to types by default?

Topics: Core, Writing modules
Developer
Jan 11, 2012 at 10: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?

Coordinator
Jan 11, 2012 at 10:57 PM

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

Developer
Jan 11, 2012 at 11:32 PM
Edited Jan 11, 2012 at 11:33 PM

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),

Coordinator
Jan 11, 2012 at 11:34 PM

Content Rules are doing that already.

Developer
Jan 11, 2012 at 11:47 PM

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

Jan 12, 2012 at 12: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>).

Developer
Jan 12, 2012 at 6:42 PM

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