When attempting to add a MerlinOne Search widget to an Entity Browser, no widgets appear in the list and the following error is thrown:


TypeError: Argument 12 passed to Drupal\merlinone\Plugin\EntityBrowser\Widget\MerlinOneSearch::__construct() must be an instance of Drupal\Core\File\MimeType\MimeTypeGuesser, instance of Drupal\Core\ProxyClass\File\MimeType\MimeTypeGuesser given, called in /mnt/www/html/pihoe8qdqkkucy/docroot/modules/contrib/merlinone/src/Plugin/EntityBrowser/Widget/MerlinOneSearch.php on line 128 in Drupal\merlinone\Plugin\EntityBrowser\Widget\MerlinOneSearch->__construct() (line 102 of /mnt/www/html/pihoe8qdqkkucy/docroot/modules/contrib/merlinone/src/Plugin/EntityBrowser/Widget/MerlinOneSearch.php) #0 /mnt/www/html/pihoe8qdqkkucy/docroot/modules/contrib/merlinone/src/Plugin/EntityBrowser/Widget/MerlinOneSearch.php(128): Drupal\merlinone\Plugin\EntityBrowser\Widget\MerlinOneSearch->__construct(Array, 'merlinone_searc...', Array, Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher), Object(Drupal\Core\Entity\EntityTypeManager), Object(Drupal\entity_browser\WidgetValidationManager), Object(Drupal\Core\Session\AccountProxy), Object(Drupal\Core\File\FileSystem), Object(Drupal\Core\Config\ConfigFactory), Object(Drupal\token\Token), Object(GuzzleHttp\Client), Object(Drupal\Core\ProxyClass\File\MimeType\MimeTypeGuesser)) #1 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(21): Drupal\merlinone\Plugin\EntityBrowser\Widget\MerlinOneSearch::create(Object(Drupal\Core\DependencyInjection\Container), Array, 'merlinone_searc...', Array) #2 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(84): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('merlinone_searc...', Array) #3 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php(81): Drupal\Component\Plugin\PluginManagerBase->createInstance('merlinone_searc...', Array) #4 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(80): Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin('ed29f11e-f563-4...') #5 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php(160): Drupal\Component\Plugin\LazyPluginCollection->get('ed29f11e-f563-4...') #6 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php(172): Drupal\Core\Plugin\DefaultLazyPluginCollection->setInstanceConfiguration('ed29f11e-f563-4...', Array) #7 /mnt/www/html/pihoe8qdqkkucy/docroot/modules/contrib/entity_browser/src/Entity/EntityBrowser.php(288): Drupal\Core\Plugin\DefaultLazyPluginCollection->addInstanceId('ed29f11e-f563-4...', Array) #8 /mnt/www/html/pihoe8qdqkkucy/docroot/modules/contrib/entity_browser/src/Form/WidgetsConfig.php(160): Drupal\entity_browser\Entity\EntityBrowser->addWidget(Array) #9 [internal function]: Drupal\entity_browser\Form\WidgetsConfig::submitAddWidget(Array, Object(Drupal\Core\Form\FormState)) #10 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/Form/FormSubmitter.php(111): call_user_func_array(Array, Array) #11 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #12 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(585): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #13 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(314): Drupal\Core\Form\FormBuilder->processForm('entity_browser_...', Array, Object(Drupal\Core\Form\FormState)) #14 /mnt/www/html/pihoe8qdqkkucy/docroot/modules/contrib/ctools/src/Wizard/WizardFactory.php(41): Drupal\Core\Form\FormBuilder->buildForm('entity_browser_...', Object(Drupal\Core\Form\FormState)) #15 /mnt/www/html/pihoe8qdqkkucy/docroot/modules/contrib/ctools/src/Controller/WizardFormController.php(79): Drupal\ctools\Wizard\WizardFactory->getWizardForm(Object(Drupal\entity_browser\Wizard\EntityBrowserWizard), Array, false) #16 [internal function]: Drupal\ctools\Controller\WizardFormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #17 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #18 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #19 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #20 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #21 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #22 /mnt/www/html/pihoe8qdqkkucy/docroot/vendor/symfony/http-kernel/HttpKernel.php(153): call_user_func_array(Object(Closure), Array) #23 /mnt/www/html/pihoe8qdqkkucy/docroot/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #24 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /mnt/www/html/pihoe8qdqkkucy/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /mnt/www/html/pihoe8qdqkkucy/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /mnt/www/html/pihoe8qdqkkucy/docroot/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /mnt/www/html/pihoe8qdqkkucy/docroot/core/lib/Drupal/Core/DrupalKernel.php(657): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /mnt/www/html/pihoe8qdqkkucy/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #33 {main}.

Drupal/module versions are:
  • Drupal Core: 8.4.5
  • MerlinOne: 8.x-1.0+6-dev (2017-Nov-20)
  • Entity Browser: 8.x-2.0-alpha2+2-dev (occurs on this version as well as 8.x-2.0-alpha2 version)
  • Media entity image 8.x-1.2+8-dev (2017-Oct-24)
  • Media Entity Browser 8.x-2.0-alpha1+0-dev (2017-Nov-12)
  • Media Entity / Media (core)
    • Media_entity will not install, cannot be used in conjunction with media module in core

Comments

AdamBernstein created an issue. See original summary.

karlshea’s picture

We're currently not compatible with media in core, but it's on the roadmap and we'll be releasing a 2.x branch that is.

adambernstein’s picture

Good to know, thank you @KarlShea!

karlshea’s picture

Sure thing! I'll update this issue when we have a 2.x branch ready. Just to be clear though, this module should function in 8.4/8.5 as long as core media isn't enabled and the contrib modules are targeting media contrib (usually their 1.x branches).

adambernstein’s picture

Just FYI, I'm actually getting this same error with core Media disabled (using Media Entity 8.x-1.7 and Entity Browser 8.x-1.4) on MerlinOne 8.x-1.0+6-dev.
MerlinOne 8.x-1.0 seems to work as expected with no errors.

karlshea’s picture

Status: Active » Needs review

Sure enough, although it never came up during development or testing (which is strange) it looks like I should have been using the MimeTypeGuesserInterface instead of MimeTypeGuesser. Does the dev release I just pushed up fix the issue for you?

adambernstein’s picture

Confirming the latest version 8.x-1.0+7-dev appears to eliminate the error, thanks Karl!

karlshea’s picture

Status: Needs review » Fixed

Awesome, glad it's working!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

karlshea’s picture

FYI there's a 2.x branch now if you'd like to test it with core media, just make sure you follow the upgrade path here.

adambernstein’s picture

Awesome, thanks for the update! Will try it out as soon as we can.