Cannot view admin form on D11

Created on 26 February 2025, 5 months ago

Problem/Motivation

I get a WSOD when trying to visit the settings page. The logged error is,

TypeError: Drupal\Core\Form\ConfigFormBase::__construct(): Argument #2 ($typedConfigManager) must be of type Drupal\Core\Config\TypedConfigManagerInterface, Drupal\Core\Extension\ModuleHandler given, called in /var/www/html/web/modules/contrib/ms_clarity/src/Form/MicrosoftClarityAdminSettingsForm.php on line 80 in Drupal\Core\Form\ConfigFormBase->__construct() (line 44 of /var/www/html/web/core/lib/Drupal/Core/Form/ConfigFormBase.php).

Steps to reproduce

Install module on a Drupal 11 site and try to visit /admin/config/services/microsoft_clarity.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States keiserjb

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

Merge Requests

Comments & Activities

  • Issue created by @keiserjb
  • 🇺🇸United States keiserjb

    The changes made to the admin form in the issue fork allow it to load successfully for me.

  • Merge request !3Fixes WSOD in D11 → (Open) created by keiserjb
  • Status changed to Needs work about 1 month ago
  • 🇺🇸United States kerasai

    This patch does seem to fix the D11 compatability by addressing https://www.drupal.org/node/3404140 and https://www.drupal.org/node/3349759 . The fixes look to be backwards compatible for D10 as well.

    A few items possibly worth addressing:

    These changes introduce some code standards/formatting violations.

    1. Inline comments
    2. Lost a docblock (::create method)
    3. Whitespace added after a method’s closing bracket

    Also, although calling Role::loadMultiple is noted in the change record where user_role_names() is deprecated, it’d be a more-appropriate solution to obtain the entity type manager service via dependency injection rather than calling the static method on the entity class.

    One last thought, the constructor could be updated to use constructor property promotion, which is a cleaner solution versus the “normal” class properties and setter code in the constructor. We'll be seeing this more throughout core and contrib in the future.

  • 🇺🇸United States kerasai

    Implemented changes as noted in #4 🐛 Cannot view admin form on D11 Active except the constructor property construction, which I decided against as it does seem to be used elsewhere in the module.

Production build 0.71.5 2024