Problem/Motivation

Admin Toolbar 3.0.3 + Storage 1.1.0-beta2

Updated to 1.1.0-beta2 and getting this error when attempting to re-save storage bundle or creating a new storage bundle.

After disabling the 'Admin Toolbar Extra Tools' submodule (provided by Admin Toolbar module), error goes away.

Steps to reproduce

1. Install/enable admin_toolbar and admin_toolbar_tools.
2. Re-save existing storage bundle or create new storage type bundle.

TypeError: Argument 6 passed to Drupal\admin_toolbar_tools\Plugin\Derivative\ExtraLinks::__construct() must be an instance of Drupal\admin_toolbar_tools\Plugin\Derivative\EntityTypeBundleInfoInterface, instance of Drupal\Core\Entity\EntityTypeBundleInfo given, called in /web/modules/contrib/admin_toolbar/admin_toolbar_tools/src/Plugin/Derivative/ExtraLinks.php on line 87 in Drupal\admin_toolbar_tools\Plugin\Derivative\ExtraLinks->__construct() (line 68 of /web/modules/contrib/admin_toolbar/admin_toolbar_tools/src/Plugin/Derivative/ExtraLinks.php)

#0 /web/modules/contrib/admin_toolbar/admin_toolbar_tools/src/Plugin/Derivative/ExtraLinks.php(87): Drupal\admin_toolbar_tools\Plugin\Derivative\ExtraLinks->__construct()
#1 /web/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php(25): Drupal\admin_toolbar_tools\Plugin\Derivative\ExtraLinks::create()
#2 /web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(99): Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator->getDeriver()
#3 /web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(87): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives()
#4 /web/core/lib/Drupal/Core/Menu/MenuLinkManager.php(164): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
#5 /web/core/lib/Drupal/Core/Menu/MenuLinkManager.php(189): Drupal\Core\Menu\MenuLinkManager->getDefinitions()
#6 /web/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php(82): Drupal\Core\Menu\MenuLinkManager->rebuild()
#7 /web/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php(70): Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->menuLinksRebuild()
#8 [internal function]: Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->onRouterRebuild()
#9 /web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#10 /web/core/lib/Drupal/Core/Routing/RouteBuilder.php(197): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#11 /web/core/lib/Drupal/Core/ProxyClass/Routing/RouteBuilder.php(83): Drupal\Core\Routing\RouteBuilder->rebuild()
#12 /web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(363): Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild()
#13 /web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install()
#14 /web/core/modules/system/src/Form/ModulesListForm.php(473): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install()
#15 [internal function]: Drupal\system\Form\ModulesListForm->submitForm()
#16 /web/core/lib/Drupal/Core/Form/FormSubmitter.php(113): call_user_func_array()
#17 /web/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
#18 /web/core/lib/Drupal/Core/Form/FormBuilder.php(593): Drupal\Core\Form\FormSubmitter->doSubmitForm()
#19 /web/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\Core\Form\FormBuilder->processForm()
#20 /web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#21 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#22 /web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#23 /web/core/lib/Drupal/Core/Render/Renderer.php(578): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#24 /web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#25 /web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#26 /vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#27 /vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#28 /web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle()
#29 /web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle()
#30 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#31 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#32 /web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
#33 /web/modules/contrib/shield/src/ShieldMiddleware.php(91): Drupal\ban\BanMiddleware->handle()
#34 /web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\shield\ShieldMiddleware->handle()
#35 /web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#36 /vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#37 /web/core/lib/Drupal/Core/DrupalKernel.php(717): Stack\StackedHttpKernel->handle()
#38 /web/index.php(19): Drupal\Core\DrupalKernel->handle()
#39 {main}

Comments

dat deaf drupaler created an issue. See original summary.

mxh’s picture

Status: Active » Closed (works as designed)

Thank you for reporting the issue.

It does not look like a problem specific to Storage Entities for me, because

  • The raised error is resided within the admin_toolbar_tools module when creating plugin derivatives. Errors should be covered by that module at least by throwing an exception. A TypeError on PHP level indicates that something happens that is completely out of expectations.
  • I checked out the 3.0.3 release of the admin_toolbar module and I have taken a look into the constructor of Drupal\admin_toolbar_tools\Plugin\Derivative\ExtraLinks. It doesn't have a 6th argument, but your reported error claims on argument #6. Is your project patching this module?
  • Another indicator that something is wrong within admin_toolbar_tools is that the error sais that it expects an object of type Drupal\admin_toolbar_tools\Plugin\Derivative\EntityTypeBundleInfoInterface but that doesn't make any sense that this namespace implements EntityTypeBundleInfoInterface. I think that there is a missing use statement in that PHP file, which is another indicator that the file might be patched by something, i.e. it differs from the original 3.0.3 release tag of admin_toolbar..
dat deaf drupaler’s picture

Thank you @mxh for explain thoroughly with your analysis.

Only patches I added are for tokens which is unrelated to this case.

I attempted to patch Admin Toolbar as recommended by this module page description (Issue #3028213) and applied the untested patch for 3.x which did not apply successfully (using composer).

After removing and re-adding Admin Toolbar module via composer (deleted and re-download), the issues had gone away. Seems as if like my composer has incorrect settings for patching.

    "extra": {
        "composer-exit-on-patch-failure": true,
        "enable-patching": true,
        },
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "patches": {
            ....
        }
    }

I shall wait until patch for Admin Toolbar 3.x get merged after some further testing.

Much appreciation for this amazingly powerful entity bundle creation module!!

mxh’s picture

Pleasure, thanks for reporting back :)