Use ModuleHandlerInterface on widget form instead of core ModuleHandler class

Created on 5 April 2023, about 1 year ago
Updated 17 November 2023, 7 months ago

Problem/Motivation

Hi, sorry for my bad english.

In my project the hook_event_dispatcher โ†’ module is installed and the modal to insert the pins does not open giving this error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /en/admin/imagepin/pin-widgets/160153/field_image/storage/focus/en/9766
StatusText: OK
ResponseText: TypeError: Drupal\\imagepin\\Form\\PinWidgetsForm::__construct(): Argument #7 ($module_handler) must be of type Drupal\\Core\\Extension\\ModuleHandler, Drupal\\hook_event_dispatcher\\HookEventDispatcherModuleHandler given, called in /var/www/html/web/modules/contrib/imagepin/src/Form/PinWidgetsForm.php on line 85 in Drupal\\imagepin\\Form\\PinWidgetsForm->__construct() (line 107 of /var/www/html/web/modules/contrib/imagepin/src/Form/PinWidgetsForm.php).

Steps to reproduce

  • Install and enable hook_event_dispatcher and imagepin module.
  • Configure imagepin on an entity
  • Try to open the modal for insert the pins

Proposed resolution

Use ModuleHandlerInterface in the widgets form instead of ModuleHandler

In the next comment the proposed patch

๐Ÿ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡นItaly robertom

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @robertom
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly robertom

    Attached the proposed patch

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia keshav.k

    keshav.k โ†’ made their first commit to this issueโ€™s fork.

  • @keshavk opened merge request.
  • Status changed to RTBC 7 months ago
  • ๐Ÿ‡ช๐Ÿ‡ธSpain lluvigne Seville, Spain

    Hello!

    I've tested the MR provided in #4 and is working fine.
    This issue it's not only affecting hook_event_dispatcher module, also other modules that decorates the core module handler, like config_track โ†’ . So widget form should definitely use ModuleHandlerInterface on arguments instead of the core module handler class.

    I'm moving this to RTBC to push this issue forward.

Production build 0.69.0 2024