0

I made a form Company Information, which contains standard fields like Name, Address, Rating etc.

Now I am taking Rating from a different content type "Company Reviews", under Rating Field.

What I want to display various fields from Company Information and Company Reviews in a single view. I tried using the machine name in twig but somehow the view is showing values from Company Information but not from Company Reviews.

Does this sound familiar? I am sure it can be done but I am missing out something. Any help or even a direction is much appreciated, thanks.


[ UPDATE 1]

So, I was researching this for a while and just after posting the question I stumbled upon "Entity Reference", but it seems that this is not available for drupal 8 can we do this in drupal 8 somehow https://www.ostraining.com/blog/drupal/entity-reference-views/


[ UPDATE 2] The entity reference was suppose to show up in Add Relation under Advance Tab

Add entity reference via advance tab

And I am getting a few fields, but not the ones I want. neither the view is showing following entity relation enter image description here

instead, I am having this on my dashboard, enter image description here

so I went ahead and added Review content filter anyway, as a result, the Listing View started showing the reviews as companies, which was not the desired result, using review title as company title.

enter image description here

Do I require a module or should something have be-be done at content types Company Profile and Review?

[ UPDATE 3 ] The Answer is correct, Here is how did it, if anyone is interested.

It was rather simple,

Suppose you have Content-Type A, and Content-Type B, and a result View C

In Content Type A, you add a field, that is actually a Reference to Content-Type B, let's call it ref-AB. Similarly, Add add a field, that is actually a Reference to Content-Type A, say ref_BA. Now fields of A & B Content-Type are related, and you can show them in the view.

To Show them in a view, you need to add "reference to the content" as a relation in view ( Go to view> your-view > advance > add relation). Suppose, you added ref_BA to your view, then all fields of content type B, will be available in your view.

In your view, add the field you want to show, making relation to ref_BA.

0

Entity Reference is now included in Drupal 8 core. To use it, simply add a field "Reference-Content" and you may use your Company Reviews content type. Then, following the tutorial from your link, you should be able to add any field from Company Reviews in a view showing content of type Company Information. enter image description here

  • I want to use the said field in a View, – BhargavSushant Feb 21 '18 at 11:28
  • That's what I understood, yes. So now with your entity reference field, you may add a relationship based on this field in your View. Then, you add a field (let's simply say the title) and you choose the relationship previously built. Finally, you will display the title of the content referenced (here the Company Reviews). This works for any field or property. – Toki Feb 21 '18 at 14:23
  • Is there any tutorial for this ? – BhargavSushant Feb 21 '18 at 14:28
  • the one you mentioned is clear (OSTraining) – Toki Feb 21 '18 at 14:29
  • but my drupal setup is not showing "Entity Reference: Referenced Entity". – BhargavSushant Feb 23 '18 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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