0

I've searched for an answer to this, I can't find it for the life of me.

I want to in a node display additional selected fields from referenced nodes, not just the title field of the referenced node.

Like follows:

CONTENT TYPE A, NODE A1
Title: Employee 134
First Name: John
Last Name: Smith
Content Type B Reference: Job 3


CONTENT TYPE B, NODE B1
Title: Job 3
Job: Carpenter
Description: Constructs tables and chairs.
Image: carpenter.jpg

I can currently only display for A1:

Employee 134
John
Smith
Job 3

I want it to display:

John Smith
Carpenter
[carpenter.jpg]
1
  • 1
    I assume you have a reference field set up, correct? If I'm right in what I'm assuming, you can use views for this. Set it to display fields, set the reference to be the node you're referencing from the reference field. Once you do this, the fields should show up in the fields section to work with.
    – rachel
    Commented Jul 11, 2019 at 18:46

2 Answers 2

0

Using display suite, create a new display mode for Content Type B, and show only the Job and Image fields.

Modify display for Content Type A to use the new display mode.

0

You can do this through Views module, it's usually referred to as displaying "Parent" info on "Child" nodes through the reference field.

  1. Create Views of type Content displaying Content type A nodes, you'll probably want to create the Block display
  2. Under Advanced (third column in Views) add the Relationship for your Reference field. You can require it if you only want to show A nodes that have a reference to B nodes.
  3. Under Fields add the Job and Image fields. They will now be available since the Relationship has been added. These fields will use that Relationship to show information from type B nodes. Without that Relationship the fields will show information from type A nodes.
  4. Now add the ID Contextual Filter (Content Category) and configure it to Provide default value from Content ID from URL (set other contextual filter options as needed). This limits Views to only show information related to the node that is currently being viewed and is showing this Views display.
  5. Save the Views and under Blocks place the newly created block into a region in your theme, and configure the Block settings for the contextual filter. Set Block Visibility to only show on node type A nodes.

This will show the referenced node information on the node that references 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.