Problem/Motivation

Remove all the occurrence of drupal_set_message() is deprecated

Proposed resolution

Drupal 8.5.x has introduced a new messenger service.

I replaced drupal_set_message() with Drupal Messenger service.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sergiu Stici created an issue. See original summary.

Sergiu Stici’s picture

Sergiu Stici’s picture

Status: Active » Needs review
Berdir’s picture

Status: Needs review » Needs work
+++ b/src/Form/PollDeleteForm.php
@@ -2,15 +2,56 @@
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('entity.repository'),
+      $container->get('entity_type.bundle.info'),
+      $container->get('datetime.time'),
+      $container->get('messenger')
+    );
+  }
+

all forms have the Messenger trait now, so we can just use $this->messenger() and remove all this.

NaheemSays’s picture

Status: Needs work » Needs review
FileSize
3.99 KB
NaheemSays’s picture

FileSize
4.01 KB
NaheemSays’s picture

Replaced an addMessage with an addError.

Berdir’s picture

Status: Needs review » Fixed

Thanks, straight-forward now.

  • Berdir committed d4375fe on 8.x-1.x authored by nbz
    Issue #3040194 by nbz, Sergiu Stici: Remove deprecated function...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.