From 96d721c05e827852b629d82cd286ee7b0fce71a0 Mon Sep 17 00:00:00 2001
From: Richard Papp <richard.papp@lakedrops.com>
Date: Thu, 13 Jun 2024 07:18:39 +0000
Subject: [PATCH] Fix workflow widget on entity add form.

---
 patches/d10-3.json                      |  3 +++
 patches/d10.json                        |  3 +++
 patches/d10/show-widget-2948377-2.patch | 13 +++++++++++++
 3 files changed, 19 insertions(+)
 create mode 100644 patches/d10/show-widget-2948377-2.patch

diff --git a/patches/d10-3.json b/patches/d10-3.json
index 470124d..8e4fe17 100644
--- a/patches/d10-3.json
+++ b/patches/d10-3.json
@@ -252,6 +252,9 @@
     "drupal/views_tree": {
       "#3344199 Add event just once": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3344199.diff"
     },
+    "drupal/workflow": {
+      "#2948377 Do not hide widget when having only one option": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/show-widget-2948377-2.patch"
+    },
     "drupal/wysiwyg_template": {
       "#3354588 Drupal 10 compatible": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3354588.diff"
     },
diff --git a/patches/d10.json b/patches/d10.json
index 3f28e4e..009cc0e 100644
--- a/patches/d10.json
+++ b/patches/d10.json
@@ -247,6 +247,9 @@
     "drupal/views_tree": {
       "#3344199 Add event just once": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3344199.diff"
     },
+    "drupal/workflow": {
+      "#2948377 Do not hide widget when having only one option": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/show-widget-2948377-2.patch"
+    },
     "drupal/wysiwyg_template": {
       "#3354588 Drupal 10 compatible": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3354588.diff"
     },
diff --git a/patches/d10/show-widget-2948377-2.patch b/patches/d10/show-widget-2948377-2.patch
new file mode 100644
index 0000000..9763a4b
--- /dev/null
+++ b/patches/d10/show-widget-2948377-2.patch
@@ -0,0 +1,13 @@
+diff --git a/src/Entity/WorkflowState.php b/src/Entity/WorkflowState.php
+index ab9660b..437bc48 100644
+--- a/src/Entity/WorkflowState.php
++++ b/src/Entity/WorkflowState.php
+@@ -323,7 +323,7 @@ class WorkflowState extends ConfigEntityBase {
+     $options = $this->getOptions($entity, $field_name, $account, $force);
+     $count = count($options);
+     // The easiest case first: more then one option: always show form.
+-    if ($count > 1) {
++    if ($count >= 1) {
+       return TRUE;
+     }
+     // #2226451: Even in Creation state, we must have 2 visible states to show the widget.
-- 
GitLab