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.

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
StatusFileSize
new3.99 KB
naheemsays’s picture

StatusFileSize
new4.01 KB
naheemsays’s picture

StatusFileSize
new4 KB

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.