Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Action / Plugin / Action / Derivative / EntityActionDeriverBase.php
index 29159c2931115cde69ed587dd81b4ccb0a389a17..5cd529a7465556229f0f831114c3555cfb1d5f96 100644 (file)
@@ -6,6 +6,8 @@ use Drupal\Component\Plugin\Derivative\DeriverBase;
 use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+use Drupal\Core\StringTranslation\TranslationInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -13,6 +15,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  */
 abstract class EntityActionDeriverBase extends DeriverBase implements ContainerDeriverInterface {
 
+  use StringTranslationTrait;
+
   /**
    * The entity type manager.
    *
@@ -25,16 +29,22 @@ abstract class EntityActionDeriverBase extends DeriverBase implements ContainerD
    *
    * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
    *   The entity type manager.
+   * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
+   *   The string translation service.
    */
-  public function __construct(EntityTypeManagerInterface $entity_type_manager) {
+  public function __construct(EntityTypeManagerInterface $entity_type_manager, TranslationInterface $string_translation) {
     $this->entityTypeManager = $entity_type_manager;
+    $this->stringTranslation = $string_translation;
   }
 
   /**
    * {@inheritdoc}
    */
   public static function create(ContainerInterface $container, $base_plugin_id) {
-    return new static($container->get('entity_type.manager'));
+    return new static(
+      $container->get('entity_type.manager'),
+      $container->get('string_translation')
+    );
   }
 
   /**