1

I created two content types: News Agency and News. The News content type has the Headline, Title, Body, and News agency name (a reference to a News Agency node) fields. The News agency content type has the News agency name and Publisher fields.

I need to show the news related to particular news agency. I am trying to set a relationship, but it still doesn't show result.

Image of News Content type

2
  • here related new agency field reference to NEWS AGENCY. How to get the views of news related to particular news agency. Commented Feb 24, 2019 at 22:31
  • Please include information about the view that you are trying to setup, your question is very broad as it is.
    – GiorgosK
    Commented Feb 25, 2019 at 6:15

1 Answer 1

0

The "Entity reference" field has a few options about how to display the referenced entities (Label, entire node, Node ID).

But you're referencing News agencies from News nodes, not the other way around. So you're able to choose how News agencies are listed on News pages through the "Manage display" settings in Content type.

If you want to list nodes on the News agency pages you need to use Views to create "backwards" Relationship:

  1. Create Views listing News, Block display
  2. Add a Contextual filter for the Entity reference field relating to the News agency and configure it When the filter value is NOT available
    Provide default value
    Content ID from URL
    When the filter value IS available or a default is provided
    Specify validation criteria
    Content Related? News agency

    Test the configuration by entering one of your News Agency NIDs into the Views Preview field. You should see News nodes that relate to that agency in the view results.

  3. If everything is working as expected place the Block into a region in your theme and configure it to only appear on the News Agency pages, and configure the filter option for the reference.

Now when you visit News Agency pages you'll see a list of all News that relate to that agency.

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.