Problem/Motivation

This module should use ModuleHandlerInterface instead of ModuleHandler to avoid issues with other modules.

When using the Hook Event Dispatcher module after 3.2.0, the settings page for CKEditor Media Embed Plugin returns this error:

TypeError: Argument 2 passed to Drupal\ckeditor_media_embed\Form\CKEditorMediaEmbedSettingsForm::__construct() must be an instance of Drupal\Core\Extension\ModuleHandler, instance of Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler given, called in /app/web/modules/contrib/ckeditor_media_embed/src/Form/CKEditorMediaEmbedSettingsForm.php on line 73 in Drupal\ckeditor_media_embed\Form\CKEditorMediaEmbedSettingsForm->__construct() (line 57 of /app/web/modules/contrib/ckeditor_media_embed/src/Form/CKEditorMediaEmbedSettingsForm.php)

See the hook_event_dispatcher release notes.

Proposed resolution

Type hint ModuleHandlerInterface instead of ModuleHandler.

CommentFileSizeAuthor
#2 3314733-2.patch2.01 KBpieter-e1

Comments

pieter-e1 created an issue. See original summary.

pieter-e1’s picture

StatusFileSize
new2.01 KB

Patch attached.

dpi’s picture

Many people are seeing errors related to ModuleHandler as a result of upgrading Hook Event Dispatcher, which includes a module handler service decorator.

Projects need to ensure interfaces are used while injecting services, so this project will need to make the code change here.

pieter-e1’s picture

Status: Active » Needs review
lamp5’s picture

Version: 8.x-1.11 » 2.0.0-alpha5
Status: Needs review » Reviewed & tested by the community

Confirmed, the patch works for 2.0.0-alpha.

  • grndlvl committed 6ab3c5ee on 8.x-1.x
    Issue #3314733 by pieter-e1, dpi, lamp5: ModuleHandler error after...

  • grndlvl committed 301cad58 on 2.x
    Issue #3314733 by pieter-e1, dpi, lamp5: ModuleHandler error after...
grndlvl’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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