Problem/Motivation

After updating to Webform Workflows Element 2.1.0, any page that loads a View using the Webform Workflows Element Views filter throws a fatal TypeError and cannot be displayed.

Error
TypeError: Cannot assign Drupal\views\Plugin\ViewsHandlerManager to property Drupal\webform_workflows_element_views\Plugin\views\filter\WebformWorkflowsElementState::$joinManager of type Drupal\views\Plugin\ViewsPluginManager in Drupal\webform_workflows_element_views\Plugin\views\filter\WebformWorkflowsElementState::create() (line 42 of /home/b28r1iiij2ob/public_html/modules/contrib/webform_workflows_element/modules/webform_workflows_element_views/src/Plugin/views/filter/WebformWorkflowsElementState.php).

Backtrace
#0 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(21): Drupal\webform_workflows_element_views\Plugin\views\filter\WebformWorkflowsElementState::create()
#1 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(78): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance()
#2 /home/b28r1iiij2ob/public_html/core/modules/views/src/Plugin/ViewsHandlerManager.php(148): Drupal\Component\Plugin\PluginManagerBase->createInstance()
#3 /home/b28r1iiij2ob/public_html/core/modules/views/src/Plugin/ViewsHandlerManager.php(133): Drupal\views\Plugin\ViewsHandlerManager->createInstance()
#4 /home/b28r1iiij2ob/public_html/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(881): Drupal\views\Plugin\ViewsHandlerManager->getHandler()
#5 /home/b28r1iiij2ob/public_html/core/modules/views/src/ViewExecutable.php(1100): Drupal\views\Plugin\views\display\DisplayPluginBase->getHandlers()
#6 /home/b28r1iiij2ob/public_html/core/modules/views/src/ViewExecutable.php(958): Drupal\views\ViewExecutable->_initHandler()
#7 /home/b28r1iiij2ob/public_html/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2345): Drupal\views\ViewExecutable->initHandlers()
#8 /home/b28r1iiij2ob/public_html/core/modules/views/src/ViewExecutable.php(1748): Drupal\views\Plugin\views\display\DisplayPluginBase->preExecute()
#9 /home/b28r1iiij2ob/public_html/core/modules/views/src/ViewExecutable.php(1683): Drupal\views\ViewExecutable->preExecute()
#10 /home/b28r1iiij2ob/public_html/core/modules/views/src/Element/View.php(80): Drupal\views\ViewExecutable->executeDisplay()
#11 [internal function]: Drupal\views\Element\View::preRenderViewElement()
#12 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(107): call_user_func_array()
#13 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/Render/Renderer.php(910): Drupal\Core\Render\Renderer->doTrustedCallback()
#14 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/Render/Renderer.php(441): Drupal\Core\Render\Renderer->doCallback()
#15 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/Render/Renderer.php(230): Drupal\Core\Render\Renderer->doRender()
#16 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->render()
#17 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/Render/Renderer.php(634): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#18 [internal function]: Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
#19 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/Render/Renderer.php(635): Fiber->start()
#20 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(235): Drupal\Core\Render\Renderer->executeInRenderContext()
#21 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(131): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#22 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#23 /home/b28r1iiij2ob/public_html/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#24 /home/b28r1iiij2ob/public_html/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}()
#25 /home/b28r1iiij2ob/public_html/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#26 /home/b28r1iiij2ob/public_html/vendor/symfony/http-kernel/HttpKernel.php(188): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#27 /home/b28r1iiij2ob/public_html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#28 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#29 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#30 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#31 /home/b28r1iiij2ob/public_html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#32 /home/b28r1iiij2ob/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(118): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#33 /home/b28r1iiij2ob/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(92): Drupal\page_cache\StackMiddleware\PageCache->pass()
#34 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#35 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#36 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#37 /home/b28r1iiij2ob/public_html/modules/contrib/remove_http_headers/src/StackMiddleware/RemoveHttpHeadersMiddleware.php(49): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#38 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(54): Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle()
#39 /home/b28r1iiij2ob/public_html/core/lib/Drupal/Core/DrupalKernel.php(745): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#40 /home/b28r1iiij2ob/public_html/index.php(19): Drupal\Core\DrupalKernel->handle()
#41 {main}

Steps to reproduce

1. Install or update to Webform Workflows Element 2.1.0.
2. Install Webform 6.3.0-rc2.
3. Create or open a View using the Webform Workflows Element Views filter.
4. Visit the page containing the View.

Result:
A TypeError is thrown before the View is rendered.

Proposed resolution

The plugin.manager.views.join service returns an instance of Drupal\views\Plugin\ViewsHandlerManager, but the class property is currently typed as ViewsPluginManager.

Changing the import and property declaration to ViewsHandlerManager resolves the TypeError.

Modify modules/contrib/webform_workflows_element/modules/webform_workflows_element_views/src/Plugin/views/filter/WebformWorkflowsElementState.php

Change line 7 from: use Drupal\views\Plugin\ViewsPluginManager;
to: use Drupal\views\Plugin\ViewsHandlerManager;

Change line 34 from: protected ViewsPluginManager $joinManager;
to: protected ViewsHandlerManager $joinManager;

After making this change and rebuilding caches (drush cr), the View loads normally and the filter functions as expected.

Command icon 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

wschwab created an issue. See original summary.

mably made their first commit to this issue’s fork.

mably’s picture

Status: Active » Needs review

Thanks for the precise diagnosis, @wschwab. I opened MR 54 with your fix (retyping $joinManager to ViewsHandlerManager) plus a small regression test. Could you apply it and confirm your View renders correctly?

Thanks again for reporting it.

wschwab’s picture

@mably I applied MR 54 to my local installation, rebuilt caches (drush cr), and verified that the View now renders correctly. The fatal TypeError is no longer present, and the Webform Workflows Element Views filter is functioning as expected.

  • mably committed 8e196678 on 2.x
    fix: #3605995 Drupal 11 fatal TypeError in WebformWorkflowsElementState...
mably’s picture

Status: Needs review » Fixed

Thanks a lot @wschwab for your feedback. Merged.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

mably’s picture

Fix included in release 2.1.1.

Status: Fixed » Closed (fixed)

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