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

  1. Install Mailsystem module
  2. Run Upgrade Status module scan
  3. 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.

Issue fork mailsystem-3566556

Command icon 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

titacvetkovic created an issue. See original summary.

dkmishra made their first commit to this issue’s fork.

dkmishra’s picture

Version: 8.x-4.5 » 8.x-4.x-dev
Status: Active » Needs review