1

I have a content type 'Testimonials' with a title field and a field configured as a Paragraph. I'm trying to create a view showing all the nodes of content type 'Testimonials'.

However, in the 'add field' section of the view creation page, i can only select the 'title' field. The fields that are part of the Paragraph are not selectable.

How can i get the fields from the paragraph so that i can show them in the view results?

I tried with 'add relationship' (Paragraph referenced from field_dl_testimonial_components) this works but i get duplicate records in my view (1 record per paragraph).

Below a screenshot showing the paragraphs that are set for the field 'components main' enter image description here

2

When working with views and entity references, which is what paragraph fields are essentially, it is preferred (in my opinion) to use rendered entities instead of relationships because of the exact issue of duplication.

Rendered entities lets you add/remove fields per view mode of the entity in a separate form.

First you must add the field of the paragraph (the one you placed on the node) to the view, choose 'Rendered Entity' and select the view mode you want (the choice of view mode depends on if you use it in other places and wouldn't want to affect appearance in these other places, or the opposite if you want to reuse appearances):

enter image description here

Then go to the paragraph management page, manage displays, and select your view mode (you can add additional view modes at the bottom)

enter image description here

From here you can configure the appearance of the paragraph like you would a content type, such as adding/removing fields.

The end result will have a view with your node titles and the paragraphs with the fields you configured in the paragraph's view mode.


Edit

In the case that a single paragraph type is needed from the field, then relationship would be appropriate here, you just need to add a filter. Add 'Type' filter and choose your paragraph type. type filter

| improve this answer | |
  • Thx for you answer, ... some pointers though: 1: Paragraphs has only 1 view mode: 'preview', you can't add extra. 2: We already use the 'preview' mode to describe the component (content type > manage form display > paragraph field > widget settings: edit mode: preview). 3: Even if we do have multiple view modes, the view would still display 'all' the components that were added to the Paragraph bundle. A solution is to create 1 field per Paragraph bundle and limit them to 1 component but that diminishes the functionality of Paragraphs (no rearranging of components, fixed position on the page) – kevinius Apr 28 '17 at 8:23
  • i have added a screenshot of my setup... As you can see, if i add the component main field to the view and choose 'rendered entity' it will display 'all' the components. – kevinius Apr 28 '17 at 8:30
  • @kevinius So you want a single field from a single paragraph? How would you know which paragraph to use? – Nir Yariv Apr 28 '17 at 10:29
  • Hey, as you can see in the screenshot, i have 5 different paragraphs. In my example i would only need C2A: visual descriptor. – kevinius Apr 28 '17 at 11:45
  • @kevinius Is there only one C2A paragraph per node? If so then a relationship would be useful here, you just need to add a filter to the view. Update your question with this specific requirement and I will update the answer. – Nir Yariv Apr 28 '17 at 12:38
0

Try this filter: enter image description here

Pardon my french, it means "is the last revision", check and apply.

| improve this answer | |

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.