Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / user / src / Form / UserMultipleCancelConfirm.php
index b4487c2656a016a8b62751c727cb6acc7639ec42..b858d6ae2487f9ca9dccb00d5efba05f72da2319 100644 (file)
@@ -5,6 +5,7 @@ namespace Drupal\user\Form;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Form\ConfirmFormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Messenger\MessengerInterface;
 use Drupal\Core\Url;
 use Drupal\Core\TempStore\PrivateTempStoreFactory;
 use Drupal\user\UserStorageInterface;
@@ -132,7 +133,7 @@ class UserMultipleCancelConfirm extends ConfirmFormBase {
     if (isset($root)) {
       $redirect = (count($accounts) == 1);
       $message = $this->t('The user account %name cannot be canceled.', ['%name' => $root->label()]);
-      drupal_set_message($message, $redirect ? 'error' : 'warning');
+      $this->messenger()->addMessage($message, $redirect ? MessengerInterface::TYPE_ERROR : MessengerInterface::TYPE_WARNING);
       // If only user 1 was selected, redirect to the overview.
       if ($redirect) {
         return $this->redirect('entity.user.collection');