0

How do I get a full-fledged entity browser with the current items list on a webform, or any custom form?

I know that adding the basic field is easy enough using hook_form_alter():

$form['field_people'] = array(
  '#type' => 'entity_browser',
  '#entity_browser' => 'people',
  '#cardinality' => 1,
);

But this doesn't include the "current items" list that gets updated via AJAX when an item is selected in the browser.

As far as I can tell, that is all set up by the widget settings associated with the form display -- something that a custom form (like a webform) wouldn't have.

Here's a related issue, but it stops short of explaining how to get the widget to work: https://www.drupal.org/project/entity_browser/issues/2816881#comment-11719437

Any ideas? Thanks!

  • This a great idea and should be developed in a dedicated webform_entity_browser module. – jrockowitz Jun 20 '18 at 0:41

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.