Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Reference View in Entity Reference field

I have a content type that has an entity reference field allowing you to link to other pages and add a custom image, for nice big CTAs.

However, it's come to light that some of the links may need to be to Views that show content as a list or map.

The ER field has autocomplete enabled and it can't find the view by its URL e.g /my-view

Is there a plugin that would allow the field to find Views? Or do I have to change the content type and add a Link field instead?

Answer*

Cancel
2
  • There is a Catch 22 with this situation too: When editing your page and searching for your View, all enabled Views will be exposed. You would normally change the Field to use 'Entity Reference View' to only expose the subset you want, but ER Views can't expose Views themselves as they are config, not content. Commented Jan 4, 2023 at 21:49
  • Yes, is an disadvantage but can be "solved" either extending ER field widget to exclude certain views or just include the ones required for the feature, or by implementing hook_form_alter or hook_field_widget_single_element_WIDGET_TYPE_form_alter if you want a nip tuck solution. Commented Jan 9, 2023 at 8:47