Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / filter / src / FilterFormatListBuilder.php
index cf084564c0b44a76a82ea5a179da1c8add18c61c..f15474694d5aadc42d43b1b3f09fc12e6793c12d 100644 (file)
@@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Messenger\MessengerInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -29,6 +30,13 @@ class FilterFormatListBuilder extends DraggableListBuilder {
    */
   protected $configFactory;
 
+  /**
+   * The messenger.
+   *
+   * @var \Drupal\Core\Messenger\MessengerInterface
+   */
+  protected $messenger;
+
   /**
    * Constructs a new FilterFormatListBuilder.
    *
@@ -38,11 +46,14 @@ class FilterFormatListBuilder extends DraggableListBuilder {
    *   The entity storage class.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The config factory.
+   * @param \Drupal\Core\Messenger\MessengerInterface $messenger
+   *   The messenger.
    */
-  public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ConfigFactoryInterface $config_factory) {
+  public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, ConfigFactoryInterface $config_factory, MessengerInterface $messenger) {
     parent::__construct($entity_type, $storage);
 
     $this->configFactory = $config_factory;
+    $this->messenger = $messenger;
   }
 
   /**
@@ -52,7 +63,8 @@ class FilterFormatListBuilder extends DraggableListBuilder {
     return new static(
       $entity_type,
       $container->get('entity.manager')->getStorage($entity_type->id()),
-      $container->get('config.factory')
+      $container->get('config.factory'),
+      $container->get('messenger')
     );
   }
 
@@ -150,7 +162,7 @@ class FilterFormatListBuilder extends DraggableListBuilder {
     parent::submitForm($form, $form_state);
 
     filter_formats_reset();
-    drupal_set_message($this->t('The text format ordering has been saved.'));
+    $this->messenger->addStatus($this->t('The text format ordering has been saved.'));
   }
 
 }