This project is read-only.

Query by ContainerID

Topics: Customizing Orchard
Aug 5, 2014 at 5:43 PM

For a project, I need to create hierarchically organized content type.

I thought using Container and Containable parts, but I didn't found how to query children (Containables) content types filtered on the Container ? Did I missed something ? (or was it Projector module ? )

Here are my content types :
  • Show (Container)
  • ShowDate (Containable)
  • News (Containable)
  • Products (Containable)
On my Show page, I would want to display ShowDates, News and Products in different widgets.

Which is the best way to achieve this ?
Aug 5, 2014 at 7:02 PM
I don't think you'll want to use container/containable. Use projections/queries instead.
Aug 6, 2014 at 8:48 AM
Yes, of course, I will use projections and queries. My question is about how to attach a child content item to a parent one, and easily filter queries on the parent.

I already made thomething similar but more complex (n-n relations) with Taxonomies, but in the current case I just need to create 1-n relations.

It can work with a ContentPickerField, but not the cleanest solution...

It seems Projections/Queries just lacks a ContainerId filter...
Aug 6, 2014 at 11:59 AM
Found the solution, already discussed here and with a closed work item.

Piedone has made a ContainedByFilter which is part of his Helpful Extensions module

I think that it should be included into the projection module...
Aug 6, 2014 at 12:54 PM
Cool, didn't know that. Seems really helpful for some customization I am currently working with