TypeError: Drupal\social_link_field\Plugin\Field\FieldFormatter\SocialLinkBaseFormatter::__construct(): Argument #10 ($module_handler) must be of type Drupal\Core\Extension\ModuleHandler, Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler given

Created on 20 March 2025, 20 days ago

Problem/Motivation

The following error appears when rendering a node page using this module's field formatter:

TypeError: Drupal\social_link_field\Plugin\Field\FieldFormatter\SocialLinkBaseFormatter::__construct(): Argument #10 ($module_handler) must be of type Drupal\Core\Extension\ModuleHandler, Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler given, called in /var/www/html/web/modules/contrib/social_link_field/src/Plugin/Field/FieldFormatter/SocialLinkBaseFormatter.php on line 52 in Drupal\social_link_field\Plugin\Field\FieldFormatter\SocialLinkBaseFormatter->__construct() (line 41 of modules/contrib/social_link_field/src/Plugin/Field/FieldFormatter/SocialLinkBaseFormatter.php).
Drupal\social_link_field\Plugin\Field\FieldFormatter\SocialLinkBaseFormatter::create() (Line: 65)
Drupal\Core\Field\FormatterPluginManager->createInstance() (Line: 127)
Drupal\Core\Field\FormatterPluginManager->getInstance() (Line: 205)
Drupal\Core\Entity\Entity\EntityViewDisplay->getRenderer() (Line: 241)
Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple() (Line: 340)
Drupal\Core\Entity\EntityViewBuilder->buildComponents() (Line: 24)
Drupal\node\NodeViewBuilder->buildComponents() (Line: 282)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple() (Line: 239)
Drupal\Core\Entity\EntityViewBuilder->build()

Steps to reproduce

Use this module in combination with Hook Event Dispatcher.

Proposed resolution

Typehint the interface instead of the class.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇧🇪Belgium dieterholvoet Brussels

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024