Problem/Motivation
The Mailsystem module uses deprecated methods that were deprecated in Drupal 10.3.0 and will be removed in Drupal 12.0.0. This causes deprecation warnings when running Upgrade Status or preparing for Drupal 11+ compatibility.
getName()
Call to deprecated method getName() of interface Drupal\Core\Extension\ModuleHandlerInterface. Deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use Drupal::service('extension.list.module')->getName($module) instead.
Affected file
- src/Form/AdminForm.php
renderPlain()
Call to deprecated method renderPlain() of class Drupal\Core\Render\Renderer. Deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use Drupal\Core\Render\RendererInterface::renderInIsolation() instead.
Affected file
- tests/modules/mailsystem_test/mailsystem_test.module
Steps to reproduce
- Install Mailsystem module
- Run Upgrade Status module scan
- Review deprecation warnings for Mailsystem
Proposed resolution
Replace ModuleHandlerInterface::getName() with the extension list service.
- Use
\Drupal::service('extension.list.module')->getName($module)instead - Inject the service properly in the form class
Replace Renderer::renderPlain() with Renderer::renderInIsolation().
- Update method call in the test module
Remove the now-unnecessary method_exists() check for invokeAllWith() as it has been available since Drupal 9.4.0.
Remaining tasks
I am attaching a patch that addresses both deprecation warnings and provides a workaround until this is fixed by the maintainers.
| Comment | File | Size | Author |
|---|---|---|---|
| mailsystem-deprecated-methods.patch | 1.47 KB | titacvetkovic |
Issue fork mailsystem-3566556
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:
Comments
Comment #4
dkmishra commented