0

I have a content type 'Article' which has a custom field of 'related articles'. This field uses the Entity Reference module and allows an admin to specify up to 4 related articles (nodes) to be shown on that page.

I'm trying to create a view block to display the teasers of those related articles on the page.

I'm struggling to set-up the view.

So far I've got it as:

enter image description here

The plan is that this view will be attached to an existing view which just shows the latest articles.

The view at the moment doesn't seem to be referencing the entity field (Related Articles) or showing those items...

Probably missing something obvious but would appreciate any pointers.

1
  • are you creating a separate block to show those teasers? if so, it doesn't work because you aren't telling it what to display - the views don't talk to each other, so the block has no idea what content it is supposed to be displaying. Probably the simplest option is to use a contextual filter for the page, that the block then reads in order to determine content
    – Geoff
    Commented Oct 9, 2014 at 1:22

1 Answer 1

1

Don't use an Entity Reference relationship for this, but rather, change your Show: to "Fields" and add the referenced entity field. Then you will be able to set the "Formatter" to "Rendered entity", and the "View mode" to "Teaser".

You may need to add a contextual filter or set this up as an attachment display rather than a block.

I can post a few screen shots if my answer isn't clear.

4
  • Thanks for this - I'm getting closer, but it seems to be fetching the 'related articles' from all nodes rather than the one the view is being shown on. I've clearly missed something... current set-up: dropbox.com/s/aw3vv731fm3n306/…
    – steve
    Commented Oct 9, 2014 at 11:59
  • The other complexity I may need to handle is a situation where the same item may appear in my latest article list as well as being specified at node level. Guessing using a hook to remove the duplicate before rendering is my best bet?
    – steve
    Commented Oct 11, 2014 at 20:44
  • I would say in that case load the nid into each view display, and use a views template to delete the duplicates.
    – Webdrips
    Commented Oct 14, 2014 at 6:38
  • Thanks that makes perfect sense. Any clues on why I'm picking up the related items from every node that has them, rather than just the node the block/view is loaded into?
    – steve
    Commented Oct 14, 2014 at 12:37

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.