Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / system / src / Form / CronForm.php
index 3957060e109a0414d4fe281480e3565168d583c7..a585aa57cb7c156bbb65cf0460848735b67b462b 100644 (file)
@@ -14,6 +14,8 @@ use Drupal\Core\Form\ConfigFormBaseTrait;
 
 /**
  * Configure cron settings for this site.
+ *
+ * @internal
  */
 class CronForm extends FormBase {
 
@@ -153,7 +155,7 @@ class CronForm extends FormBase {
     $this->config('system.cron')
       ->set('logging', $form_state->getValue('logging'))
       ->save();
-    drupal_set_message(t('The configuration options have been saved.'));
+    $this->messenger()->addStatus(t('The configuration options have been saved.'));
   }
 
   /**
@@ -161,10 +163,10 @@ class CronForm extends FormBase {
    */
   public function runCron(array &$form, FormStateInterface $form_state) {
     if ($this->cron->run()) {
-      drupal_set_message($this->t('Cron ran successfully.'));
+      $this->messenger()->addStatus($this->t('Cron ran successfully.'));
     }
     else {
-      drupal_set_message($this->t('Cron run failed.'), 'error');
+      $this->messenger()->addError($this->t('Cron run failed.'));
     }
   }