Problem/Motivation
The message_banner module is incompatible with Drupal 11 due to several issues:
1. ConfigFormBase constructor change - In Drupal 11, ConfigFormBase::__construct() requires a second parameter (TypedConfigManagerInterface). The current code calls parent::__construct($config_factory) which causes ArgumentCountError: Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct().
2. Incorrect config schema type - The config schema uses type: config_entity but this is simple configuration, not a config entity. Should be type: config_object.
3. Deprecated AccountInterface constants - The install hook uses AccountInterface::AUTHENTICATED_ROLE and AccountInterface::ANONYMOUS_ROLE which are deprecated.
4. Missing PHP 8.1+ features - Properties lack type declarations, methods lack return types.
Steps to reproduce
1. Install Drupal 11
2. Install message_banner module
3. Navigate to /admin/config/user-interface/message-banner
4. Error: ArgumentCountError: Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct()
Proposed resolution
1. Use parent::create() pattern for D11 ConfigFormBase compatibility (per https://www.drupal.org/node/3404140)
2. Fix config schema: config_entity → config_object
3. Replace deprecated AccountInterface constants with string literals
4. Add typed properties and return types
5. Update core_version_requirement to ^10.3 || ^11
6. Update composer.json with PHP 8.1+ requirement
Remaining tasks
- Review and test
- Merge
User interface changes
none
API changes
none
Data model changes
None (config schema type correction is a fix, not a change to stored data)
Issue fork message_banner-3565290
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:
- 3565290-drupal-11-compatibility
changes, plain diff MR !8
Comments
Comment #3
oivanov commentedthe MR is ready for review
Comment #4
sophie.skThanks for the work on this. Committing the fix and crediting lfersoy and dieterholovet from #3433363: Automated Drupal 11 compatibility fixes for message_banner.