So the scenario is like this: I have to create a "node" which has an entity reference field which can hold multiple values. I am looking for a way to be able to select view results to be stored in the entity reference field and I do not know how to do that in Drupal 8.

For Drupal 7 there was this module which does what I need https://www.drupal.org/project/entityreference_view_widget

I have tried doing it the custom way by creating views and placing them on the same page as the node create and then getting the resulting values with ajax to store in the field but I do not believe that is the best way to go about it as it does not seem reliable.

Any advice is appreciated.

  • 1
    What are the view results that you are trying to store? With just the core modules, you can use a custom view to set an entity reference field, including the case of multiple values. – Patrick Kenny Jan 19 at 11:37
  • For example I have a view with lots of filters which returns users, and from the view I need to use checkboxes to select which users I want to select to save in my reference field. – Lia Jan 19 at 12:29
  • 3
    The closest match to the link you shared is to use the Entity Browser module. – sonfd Jan 19 at 12:34
  • Thank you @sonfd. That was exactly what I was looking for! You should post it as an answer so I can mark it. – Lia Jan 19 at 17:02

The closest match to the link you shared is the Entity Browser module.

Goal of this module is to provide a generic entity browser/picker/selector. It can be used in any context where one needs to select few entities and do something with them.

The module allows you to build your own widgets (similar to the Media Library) to use with entity reference fields or in WYSIWYGs, via integration with the Entity Embed module. You can create widgets with multiple options, an option to create new content (with the entity_form submodule), and select existing content via view displays.

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.