'Drupal 9: How to reference a view in a paragraph field type
In my Drupal website, I'm using the paragraphs module to build the pages's main content. One of my paragraph types is called 'News'. This paragraph type contains a field that should reference to a 'recent news items view'. This view is already created, but I can't figure out the setup to reference this view in my paragraph field. I already tried many configurations and followed a few tutorials, all with the same result.
I think the issue lies with creating the new field. When creating the field, I have to select the field type. According to me, this must be 'Reference > Content'
Thereafter I must setup the 'Field settings > Type of item to reference'. There I go for 'Content > Content'.
The problem now is that I can only select my 'content types' as a reference, while I must be able to select a view.
So my final question is; Which configuration to choose, so I can select a view as output?
Solution 1:[1]
Views are not referenceable by a field by default. You need either the Views Reference module: https://www.drupal.org/project/viewsreference
... or the Block Reference module: https://www.drupal.org/project/blockreference
This will allow you to add to your paragraph type a field that may reference your 'recent news items' view.
Solution 2:[2]
- Instead of Reference->Content select Reference->Other.
- On the next step change "Type of item to reference" from Content to View (it's at the bottom of the list).
- Click "Save field settings"
- On the next screen click "Save settings"
- Optionally go to "Manage form display" tab and change widget for the field (by default it's autocomplete field)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | linicha |