From 6575115d7d6384fcda44a8e426dd4a44b0e9312e Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen.haas@lakedrops.com>
Date: Sat, 25 May 2024 11:19:02 +0200
Subject: [PATCH] Add patch to prompt

---
 patches/d10-3.json       |  3 +++
 patches/d10/3449733.diff | 48 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)
 create mode 100644 patches/d10/3449733.diff

diff --git a/patches/d10-3.json b/patches/d10-3.json
index 910e1b2..cc1a7a5 100644
--- a/patches/d10-3.json
+++ b/patches/d10-3.json
@@ -182,6 +182,9 @@
     "drupal/profile": {
       "#2899744 Multi-lingual": "https://www.drupal.org/files/issues/2022-04-17/2899744-54.patch"
     },
+    "drupal/prompt": {
+      "#3449733 ECA 2": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3449733.diff"
+    },
     "drupal/recaptcha": {
       "#3113837 Downgrade unknown error": "https://www.drupal.org/files/issues/2020-02-15/3113837-2.recaptcha.Downgrade-unknown-error-info.patch"
     },
diff --git a/patches/d10/3449733.diff b/patches/d10/3449733.diff
new file mode 100644
index 0000000..87619b3
--- /dev/null
+++ b/patches/d10/3449733.diff
@@ -0,0 +1,48 @@
+diff --git a/src/Plugin/Action/PromptSetFieldValue.php b/src/Plugin/Action/PromptSetFieldValue.php
+index 86155094b87b7da45120e03107982b170fe0973b..c6841a61a1da651917c51e04412eb8a2d94b3a67 100644
+--- a/src/Plugin/Action/PromptSetFieldValue.php
++++ b/src/Plugin/Action/PromptSetFieldValue.php
+@@ -62,7 +62,7 @@ class PromptSetFieldValue extends SetFieldValue {
+    * {@inheritdoc}
+    */
+   protected function getFieldsToUpdate() {
+-    $name = $this->tokenServices->replace($this->configuration['field_name']);
++    $name = $this->tokenService->replace($this->configuration['field_name']);
+     return [$name => ''];
+   }
+ 
+@@ -70,7 +70,7 @@ class PromptSetFieldValue extends SetFieldValue {
+    * {@inheritdoc}
+    */
+   protected function getValueToUpdate($entity) {
+-    $name = $this->tokenServices->replace($this->configuration['field_name']);
++    $name = $this->tokenService->replace($this->configuration['field_name']);
+     $prompt_id = $this->configuration['prompt_id'];
+ 
+     $values = \Drupal::service('prompt.service')->prompt_request($prompt_id, $entity, TRUE);
+@@ -78,14 +78,14 @@ class PromptSetFieldValue extends SetFieldValue {
+     // Process the field values.
+     $use_token_replace = TRUE;
+     // Check whether the input wants to directly use defined data.
+-    if ((mb_substr($values, 0, 1) === '[') && (mb_substr($values, -1, 1) === ']') && (mb_strlen($values) <= 255) && ($data = $this->tokenServices->getTokenData($values))) {
++    if ((mb_substr($values, 0, 1) === '[') && (mb_substr($values, -1, 1) === ']') && (mb_strlen($values) <= 255) && ($data = $this->tokenService->getTokenData($values))) {
+       if (!($data instanceof TypedDataInterface) || !empty($data->getValue())) {
+         $use_token_replace = FALSE;
+         $values = $data;
+       }
+     }
+     if ($use_token_replace) {
+-      $values = $this->tokenServices->replaceClear($values);
++      $values = $this->tokenService->replaceClear($values);
+     }
+ 
+     return [$name => $values];
+@@ -96,7 +96,7 @@ class PromptSetFieldValue extends SetFieldValue {
+    *
+    * @throws \Drupal\Core\Entity\EntityStorageException
+    */
+-  public function execute($entity = NULL) {
++  public function execute(mixed $entity = NULL): void {
+     if (!($entity instanceof FieldableEntityInterface)) {
+       return;
+     }
-- 
GitLab