Hi there,
Sorry if this is in the wrong place.
Upon installation of Media + Entity browser I get the following when trying to upload a file in the modal view. Have tried using Entity Browser 1.0 and the dev branch, on different machines. All have the exact same issue.
Steps:
- drush en media
- Create an empty content type 'Test'
- Add an Image reference field
- Set form display type to Entity Browser with the Gallery Media library option selected
- Create a new Test content item and hit the Select Media button on the image reference field
- In the modal, click the upload images tab and select an image to upload
- Press select entities and immediately get the below error in the modal
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to file_validate() must implement interface Drupal\file\FileInterface, instance of Drupal\media_entity\Entity\Media given, called in /path/to/drupal/modules/contrib/entity_browser/src/Plugin/EntityBrowser/WidgetValidation/File.php on line 31 in file_validate() (line 286 of core/modules/file/file.module).
file_validate(Object, Array) (Line: 31)
Drupal\entity_browser\Plugin\EntityBrowser\WidgetValidation\File->validate(Array, Array) (Line: 319)
Drupal\entity_browser\WidgetBase->runWidgetValidators(Array, Array) (Line: 294)
Drupal\entity_browser\WidgetBase->validate(Array, Object) (Line: 251)
Drupal\dropzonejs_eb_widget\Plugin\EntityBrowser\Widget\DropzoneJsEbWidget->validate(Array, Object) (Line: 171)
Drupal\entity_browser\Form\EntityBrowserForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 83)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 270)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'entity_browser_gallery_media_library_form') (Line: 119)
Drupal\Core\Form\FormValidator->validateForm('entity_browser_gallery_media_library_form', Array, Object) (Line: 571)
Drupal\Core\Form\FormBuilder->processForm('entity_browser_gallery_media_library_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('entity_browser_gallery_media_library_form', 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: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
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)
Comments
Comment #2
achraffessi commentedI have the same problem,
any solution please ?
Comment #3
stijndmd commented@hdonet: have you tried this with the previous (8.x-1.0-rc2) version as well?
Comment #4
stijndmd commentedYou need to add a Media reference field of type: image, instead of a image reference field.
Comment #5
hdotnet commentedThe add new field drop down doesn't contain any image entries under the Media option group:
Comment #6
stijndmd commentedYou need to add a reference field instead.
Reference group => Other
Next step: Content group => Media
Next step: in the field setup you can pick one of your created media bundles.
Comment #7
remyyyyy@stijndmd thank u !!
Comment #8
remyyyyyComment #10
panchoThis might possibly be a Won't fix, however most certainly it is not fixed, and new similar issues have been opened.
Would someone please mark this a duplicate of #2930677: Validate widget entity type and bundles, because I can't. Thanks!
Comment #11
oknate