Problem/Motivation

Site broken. Use Dependency Injection to provide the appropriate object to Acquia-VWO Connect SettingsForm constructor.

Steps to reproduce

Install this module Hooks Event Dispatcher

Go to: /admin/config/system/acquia_vwo

You will get the following error:

The website encountered an unexpected error. Try again later.

TypeError: Drupal\acquia_vwo\Form\SettingsForm::__construct(): Argument #3 ($module_handler) must be of type Drupal\Core\Extension\ModuleHandler, Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler given, called in /app/docroot/modules/contrib/acquia_vwo/src/Form/SettingsForm.php on line 49 in Drupal\acquia_vwo\Form\SettingsForm->__construct() (line 36 of modules/contrib/acquia_vwo/src/Form/SettingsForm.php).

Drupal\acquia_vwo\Form\SettingsForm::create(Object) (Line: 41)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('\Drupal\acquia_vwo\Form\SettingsForm') (Line: 48)
Drupal\Core\Controller\HtmlFormController->getFormObject(Object, '\Drupal\acquia_vwo\Form\SettingsForm') (Line: 58)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 637)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

In Drupal\acquia_vwo\Form\SettingsForm.php change line 7:

From:

use Drupal\Core\Extension\ModuleHandler;

To:

use Drupal\Core\Extension\ModuleHandlerInterface;

Issue fork acquia_vwo-3547932

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

rodetrev created an issue. See original summary.

rodetrev’s picture

StatusFileSize
new1.18 KB

Use ModuleHandlerInterface instead of concrete ModuleHandler class in acquia_vwo/src/Form/SettingsForm.php