In content add and content type edit page instead for entity browser an error message shows. Its only for some content types, rest of the content types it works fine.
Entity browser not found.
Warning: key() expects parameter 1 to be array, null given in Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget::processEntityBrowser() (line 400 of modules/contrib/entity_browser/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php).
Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget::processEntityBrowser(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 982)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1045)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1045)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1045)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 557)
Drupal\Core\Form\FormBuilder->processForm('field_config_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 142)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
version: '8.x-1.3'
We have deleted media contents manually from admin/content
Hope that's the issue, but still it need to be fixed.
Comment | File | Size | Author |
---|---|---|---|
#25 | 2914385-25.patch | 915 bytes | acbramley |
Issue fork entity_browser-2914385
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
deepakrmklm CreditAttribution: deepakrmklm at Zyxware Technologies commentedComment #3
mattsqd CreditAttribution: mattsqd as a volunteer commentedI ran into this same issue and did not have time to track down why it happened but it happened after I added a second media field to an entity. For some reason, the Drupal Settings that control the entity browser config are not saved to the field. I opened the manage field page, clicked the gear to edit the settings for the entity browser, then changed anything (I switched between image and entity browser), then saved. The $element['#attached']['drupalSettings']['entity_browser'] was then set for the field and stopped this error.
Comment #4
jjchinquist CreditAttribution: jjchinquist commentedWe are using entity_browser 8.x-1.4 and receive the same problem. The node type is "recipe".
Comment #5
markdorisonComment #6
saurabh.dhariwal CreditAttribution: saurabh.dhariwal at AddWeb Solution Pvt. Ltd. commentedHi All, I review all comments that mentioned above, I also got the same warning on Node Add/edit. Please try with my attached patch, in that tried to remove it. Hope this helps you.
Thanks!.
Comment #7
deepakrmklm CreditAttribution: deepakrmklm at Zyxware Technologies commentedPatch in #6 is enough to fix the warning issue, as its checking the existence before applying key function.
Comment #8
handkerchief#6 works. Could you commit this patch?
Comment #9
sch2 CreditAttribution: sch2 commentedStill works on 2.5 version. We were seeing this issue on some node edit/create forms.
Comment #10
JasonLuttrellI can also confirm that the patch in #6 addresses the warnings that were appearing in my logs as well. It applies to the latest version, 2.5. It's RTBC. Thanks.
Comment #11
neclimdulRan into this through some weirdness today. Field had been disabled ages ago, widget was broken, something something. No real idea how that field got in the state it was in.
The patch "works" in that it fixes the fatal error and the "Entity browser @browser not found" and related messages from EntityBrowserElement is show in the form. I don't think its correct though. It adds a drupalsetting entry for the uuid ''. Its possible something somewhere else could assume all the keys are valid uuids (because they should be) and break in a similar way.
Instead, the same empty checkout should be used but in an if too skip the entire section. Its pretty self explanatory but it also wouldn't hurt to have a note like "If there is something wrong with the widget, skip processing."
Comment #12
sanoopuio CreditAttribution: sanoopuio commentedComment #13
adis.handanovic CreditAttribution: adis.handanovic at Spry Digital, LLC commentedRan into very similar issues and used @sanoopuio's patch. Worked great - thank you for sharing with us!
Comment #14
BerdirAs #11 said, this should wrap the whole thing in an if statement and possibly also log a warning or something, because the only reason for this that I can see is misconfiguration. An entity browser widget that uses a non-existing entity browser.
Instead of patching it in afterwards, what would make more sense is changing \Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget::formElement(), to check if this browser really exists, and if not, then display a warning/error directly there?
The widget even declares the config dependency, so I really have no idea how so many people end up with such invalid configurations?
Comment #15
DuneBLI confirm #12 is doing the job.
This is coming from a non configured entity browser setting
Comment #16
poorva CreditAttribution: poorva as a volunteer and commentedAfter appending the patch, error is gone but looks like patch is not working fine. One weird issue appears which says "entity browser not found".
Comment #17
linichalexey CreditAttribution: linichalexey at EPAM Systems commented@poorva your screenshot says that patch works perfectly fine.
I can confirm that the patch #12 works fine.
@berdir I'm not sure, if others face this issue by adding standard entity reference field via ui, but I faced it while custom entity reference field creation.
Here are the steps to reproduce the issue in my case:
In my case it's clear why I got such an error. Because during field creation entity browser type wasn't set yet, it's set only after complete field creation in form display settings.
But it shouldn't happen during creation of a filed using core field type "entity reference", because its default widget is "entity_reference_autocomplete".
Comment #18
linichalexey CreditAttribution: linichalexey at EPAM Systems commentedComment #19
farse CreditAttribution: farse at Zoocha commentedI'm experiencing same behaviour as https://www.drupal.org/project/entity_browser/issues/2914385#comment-148...
Patch #12 also works for me in solving the ajax error. My problem case was adding a paragraph to a content type that had another paragraph within it (with an image using entity browser). This has solved the issue of the ajax error and the paragraph appears on the page now but when I go to the image it says "Entity browser not found" now.
I have fixed this now but resaving the widget in the manage form display.
Comment #20
esod CreditAttribution: esod commentedThis bug surfaced when switching the widget from
Entity browser
toAutocomplete
for an unlimited Entity reference taxonomy field. No problem making the switch, but when reloading the node form display, the page fatals. Patch #12 get the node form display printing again.Comment #21
alexdoma CreditAttribution: alexdoma commentedcomment #19 helps me - resaving the widget in the manage form display
Comment #22
neclimdulI'm not sure why this is RTBC. One of the maintainers and I both said it should be handled different than the current patch.
To be extra clear, both lines of the processing function need to be inside the if statement to avoid triggering additional bugs.
This line also needs to not run with an invalid id.
This should be a simple re-roll.
Comment #23
manishdrupaldev CreditAttribution: manishdrupaldev as a volunteer commentedI have fixed the issue using patch #12
Version: 8.x-2.9
PHP: 8.1.20
Comment #24
danrodPatch # 12 works great to me:
- Drupal 10.1.2
- PHP 8.1.5
- Entity Browser 8.x-2.9
Comment #25
acbramley CreditAttribution: acbramley at PreviousNext for Service NSW commentedJust ran into this myself, similar to #11 it was due to an old, broken field type/widget. Thought I might as well implement what has been asked for and ignored a few times 😅
Comment #26
Orkut Murat YılmazI've tested patch #25 and it is working for me. Thank you all:)
Comment #27
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedWould be great if this could be merged!
Comment #28
jonas139 CreditAttribution: jonas139 at iO commentedThe patch also works for me! Thanks
Comment #29
Dave ReidI still don't see this being addressed in the latest version.
Comment #32
chetan 11 CreditAttribution: chetan 11 at Virasat Solutions commentedComment #33
joseph.olstadMR 37 looks good
Comment #34
acbramley CreditAttribution: acbramley at PreviousNext for Service NSW commentedPer #29 we need to log a warning.