I'm having trouble getting the entity browser widget to work correctly in a custom form. Just wondering if anyone has had any success in getting it working. I've got to the point the button is rendering, you can use the browser, select the media. The the media id is also attached to the hidden field the widget generates.
...from my digging around it looks like it never creates the right markup in the "current" div that get sent back from the ajax request that triggers on "process"
Code below...
$form['entity_browser_wrapper'] = [
'#type' => 'container',
'widget' => [
'#title' => t('Entity Browser'),
'#field_name' => 'entity_browser_wrapper',
'#field_parents' => [],
'#required' => false,
'#parents' => ['entity_browser_wrapper'],
'#tree' => true,
'#id' => 'edit-entity-browser-wrapper',
'#type' => 'details',
'#open' => true,
'entity_browser' => [
'#type' => 'entity_browser',
'#entity_browser' => 'document_browser',
'#cardinality' => 1,
'#entity_browser_validators' => ['entity_type' => ['type' => 'media']],
'#process' => [
['\Drupal\entity_browser\Element\EntityBrowserElement', 'processEntityBrowser'],
['\Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget', 'processEntityBrowser'],
]
],
'current' => [
'#theme_wrappers' => ['container'],
'#attributes' => [
'class' => 'entities-list',
],
'items' => [],
],
],
];
This is based off a question I found in the entity browser issues https://www.drupal.org/node/2816881. I've looked into the suggestions that were posted and have come up blank.
Thanks