1

I work for an organization that makes research grants. We periodically write "research briefs" for our grants to summarize what they found. My test Drupal site has a view of research briefs, and what I'd like is to display a block of grant information as a user is looking at a specific research brief.

I've got two custom content types: grants and research-briefs. The research-brief content type has a node reference field to grant ID. I use pathauto, so an example research-brief path is: site.org/research-brief/551023442 where 551023442 is the grant ID.

The way it seems I should set up the block view contextual filter is: Content: Parent ID (field_parent_id) When the filter is not available: Provide the default value. Type: Raw value from URL Path component: 2 Use path alias: checked

This doesn't work and I've tried any number of fields and any number of configuration options and would sure appreciate any helpful pointers. If I display all results I can see all grants in the block.

2 Answers 2

0

I'd try this with a contextual filter for the research brief content:nid and then use the default value: node id from the url. This works regardless of pathauto and always provides the correct node is for the research brief.

Then add a Views relationship (join) from the Research brief to the Grant. Select the node reference field for this relationship.

Finally select the fields you want to display, using the Grant relationship.

2
  • Thank you! I tried a few different relationships, but the one that worked was "Content: Grant ID (field_grantid) - reverse"
    – B. Swans
    Commented May 18, 2016 at 16:57
  • Awesome. You can select the 'tick' symbol next to the answer to mark it as solved. Commented May 18, 2016 at 17:47
0

Please use Contextual Filter :

View Of the Page URL Should be : research-brief/%

In Context Filter : Please Click on Add Button

It will display all the fields of the Content type : research briefs

In which search, reference Id field in the research brief of grant. It might be grant ID. Then select it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.