We have a fairly straight forward entity browser configured that has the the Entity Form on the first tab and a media library view on the second one. When we switch from the entity form tab to the view tab it throws the following error:
TypeError: Argument 1 passed to file_validate() must implement interface Drupal\file\FileInterface, instance of Drupal\media\Entity\Media given, called in entity_browser/src/Plugin/EntityBrowser/WidgetValidation/File.php on line 34 in file_validate() (line 323 of core/modules/file/file.module).
It seems like clicking off the form to the other tab triggers the validation logic on the entity form, but because nothing has been added to that form it results in the above.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | entity_browser-n3122383-2.patch | 1.34 KB | damienmckenna |
Comments
Comment #2
damienmckennaA stopgap to stop our site from breaking when folks try to use the media browser :)
Comment #3
akalata commentedIs this a dupe of #2930677: Validate widget entity type and bundles?
Comment #4
berdir> but because nothing has been added to that form it results in the above
It's not empty though. It's a media entity, while that is for some arcane reason trying to validate a file. Which it simply shouldn't do.
Comment #5
chris matthews commentedCame across this issue on a site today. Can anyone comment as to whether or not the patch in this issue is best, or the one in #2930677: Validate widget entity type and bundles?
Comment #6
chris matthews commentedI applied the patch in #2, but I'm still getting:
The entity must be of type file.Comment #7
nelo_drup commented@Chris Matthews Same error
Comment #8
benstallings commented