This project is read-only.

Are there any inheritance support for ContentParts?

Jan 22, 2011 at 12:35 AM

I mean if I have one part inherited from other will Orachard runtime render it using appropriate Driver?

Jan 22, 2011 at 12:45 AM

Probably not. What's the scenario for that?

Jan 22, 2011 at 12:56 AM
Edited Jan 22, 2011 at 12:56 AM

I am trying to introduce a better way of having some kind of blog post that differs from all others. For example one that has a predefined slug, no tags, no comments and one of my own ContentParts.

And I wanted to use inheritace, because now creating of custom blog post type looks like the following:

  • create MyMegaBlogPost ContentType
  • create MyMegaBlogPost ContentPart
  • create a Driver for ContentPart

And here is where problems starts, in order to make blog module able to treat "MyMegaBlogPost" like any other "BlogPosts" (to be able to aggregate it with other posts in one list or in "Total posts" labels) I need to go to several places (e.g. BlogService) and modify several methods returning a list of "BlogPosts" to include ones of "MyMegaBlogPost" type.

And this will not be a problem if I only have one custom blog post type, but there will be a lot of them for our application and I don't like to make such kind of changes for all of them. May be you can advice something? Thanks!

Jan 22, 2011 at 1:08 AM

I would do things a little differently. You could for example add a part to regular blog posts and suppress the parts you don't want from a handler.

In other terms, thing aggregation rather than derivation.

Jan 22, 2011 at 1:15 AM
Edited Jan 22, 2011 at 1:16 AM

Good suggestion, can you help me please to understand it a little bit better? So if I understand you right I will need to do the following things:

When I click on "Create my mega Step" I will

  • go to appropriate controller
  • dynamically add ContentPart to the "Step" content type
  • in the driver of this ContentPart remove/change other ContentParts

If so, I don't understand one thing, how I can distinguish ordinal step from "my mega step" when going to edit or display mode? I know that I have some special blog post only in the moment of creation.

Jan 22, 2011 at 11:03 AM

Any ideas?

Jan 23, 2011 at 5:27 AM

Not exactly. I would just create an extra part and add that part to the existing blog post type from the migration. Then from the driver, yes, try to access the other parts and do whatever. To distinguish the ordinary posts from your own, you could have a bool property on your part. But I'm not sure what workflow you have in mind for the creation of those things.