Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / system / tests / modules / form_test / src / Form / FormTestStorageForm.php
index f81658d537d79d9f129849f8f016f499c267c4d6..5cc09b72806905ae5e030b277a70779643cd50e1 100644 (file)
@@ -50,7 +50,7 @@ class FormTestStorageForm extends FormBase {
     }
     // Count how often the form is constructed.
     $_SESSION['constructions']++;
-    drupal_set_message("Form constructions: " . $_SESSION['constructions']);
+    $this->messenger()->addStatus("Form constructions: " . $_SESSION['constructions']);
 
     $form['title'] = [
       '#type' => 'textfield',
@@ -136,10 +136,10 @@ class FormTestStorageForm extends FormBase {
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    drupal_set_message("Title: " . Html::escape($form_state->getValue('title')));
-    drupal_set_message("Form constructions: " . $_SESSION['constructions']);
+    $this->messenger()->addStatus("Title: " . Html::escape($form_state->getValue('title')));
+    $this->messenger()->addStatus("Form constructions: " . $_SESSION['constructions']);
     if ($form_state->has(['thing', 'changed'])) {
-      drupal_set_message("The thing has been changed.");
+      $this->messenger()->addStatus("The thing has been changed.");
     }
     $form_state->setRedirect('<front>');
   }