I have a field in Entity reference type for selecting a view. It works well (allowing the user to select the view) but I want to narrow down offered values, to sub set of some specific views. When defining the field there is no option to select which views can be references, as i.e. for referencing nodes (supported list of content types). To do that I have to create a view that would list views in entity reference display type and add some filters to exclude views I don't want. But when I'm creating a view in "show" filed there is no "view" type?!? Is it possible to create a view that lists all views?

  • 1
    This is probably not possible to use a View display filtering view config entities, because Views can't handle config entities. Not only in this matter the core entity reference field is quite useless in handling Views, try Views Reference Field – 4k4 Apr 13 at 15:50
  • My idea is to have tag fields for selecting view parameters, and to embed view from twig. That way admin can search tags and with this field it must enter tag id, which is not user friendly. I just need a way to offer only views suitable for twig instead of all of them. – MilanG Apr 14 at 6:33
  • @kiamlaluno this view really have to return multiple views, not just one. – MilanG Apr 14 at 6:48
  • You could replace the default selection with a custom @EntityReferenceSelection plugin where you can change the query. I found an example in the Webform module, which also is a config entity: Drupal\webform\Plugin\EntityReferenceSelection\WebformSelection – 4k4 Apr 14 at 6:54

Your Answer

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

Browse other questions tagged or ask your own question.