简体   繁体   中英

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?

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.

Try to use Views Reference Field module.

  1. Instead of Reference->Content select Reference->Other.
  2. On the next step change "Type of item to reference" from Content to View (it's at the bottom of the list).
  3. Click "Save field settings"
  4. On the next screen click "Save settings"
  5. Optionally go to "Manage form display" tab and change widget for the field (by default it's autocomplete field)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM