Accessing a contentpicker field value

Topics: Administration, Core, Customizing Orchard, General
Mar 15, 2014 at 12:33 PM
Edited Mar 15, 2014 at 12:34 PM
Hi,
I define 2 content type:
Magazine
MagazinePages

In Magazine content type I have a contentpicker field to select MagazinePages.
And also have a contentpicker field to select BlogPost content type that contain each page newspaper.

Magazine -> MagazinePage -> BlogPost (news content)

I want to display Magazine and MagazinePage and BlogPost content in a single page. but orchard only show links to MagazinePage like below:

Magazine Pages: view, view

How to access a contentpicker field value from template??

My question similar to this question but I don't find solution for it.


Thanks guys and excuse me for my bad English.
Developer
Mar 15, 2014 at 1:33 PM
So you basically want to flatten the display: currently everything is displayed as Summary, but really you want to display them in Detail: you could add ProjectionPart to Magazine and MagazinePage to list "included" content items, in Detail display type. I'm not sure whether there is a Projector filter for fetching items selected through a content picker field, but you could try using something like this: https://helpfulextensions.codeplex.com/wikipage?title=Projector%20Extensions&referringTitle=Documentation (IdsInFilter).
Mar 16, 2014 at 6:56 AM
Thanks Piedone for your attention .

Piedone wrote:
So you basically want to flatten the display: currently everything is displayed as Summary, but really you want to display them in Detail
Exactly I want to show each Magazine with MagazinePages and BlogPost (each blogpost contain text and image for a news in a MagazinePages) in a single page.

Piedone wrote:
you could add ProjectionPart to Magazine and MagazinePage to list "included" content items, in Detail display type.
I don't found ProjectionPart in orchard?

Piedone wrote:
I'm not sure whether there is a Projector filter for fetching items selected through a content picker field, but you could try using something like this: https://helpfulextensions.codeplex.com/wikipage?title=Projector%20Extensions&referringTitle=Documentation (IdsInFilter).
Also
Thank you for introducing helpfulextentions it seems that this project is very useful but how to use helpfulextentions for this issue??
It seems this project very new and I couldn't find any example or release for this on orchard gallery and codeplex.

Please guide me. Thanks again man.
Developer
Mar 16, 2014 at 10:33 PM
Helpful Extensions is not a full solution yet; as I mentioned I don't think there is a Projector filter that would exactly do what you need (i.e. fetch items picked with Content Picker). But what I linked (or rather, the source there) could help you to develop your own, because it's quite similar. It's a 3rd party project BTW (mine) so not part of Orchard.

ProjectionPart is from the built-in Orchard.Projections (or Projector) module, what is also enabled if you use the Default recipe. After the module is enabled you should find ProjectionPart among the content parts under Content Definition and you should be able to attach it to your content types (if it's not set as attachable, then you should untick this checkbox first, or attach it from code).