From 4ed5fefbb64fe19c20f46c4553908871d21282e3 Mon Sep 17 00:00:00 2001
From: jrockowitz <3537824+jrockowitz@users.noreply.github.com>
Date: Tue, 9 Jul 2024 20:25:37 -0400
Subject: [PATCH] Issue #3460229: Add the ability to require additional type
 before displaying the node edit form

---
 config/install/schemadotorg.settings.yml                  | 1 -
 ...SchemaDotOrgAdditionalTypeHtmlEntityFormController.php | 4 +++-
 .../src/Functional/SchemaDotOrgAdditionalTypeTest.php     | 8 +++-----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/config/install/schemadotorg.settings.yml b/config/install/schemadotorg.settings.yml
index 93d8f497f..ecd4f2c4d 100644
--- a/config/install/schemadotorg.settings.yml
+++ b/config/install/schemadotorg.settings.yml
@@ -943,7 +943,6 @@ schema_properties:
     - editEIDR
     - encoding
     - encodingFormat
-    - funder
     - funding
     - geoContains
     - geoCoveredBy
diff --git a/modules/schemadotorg_additional_type/src/Controller/SchemaDotOrgAdditionalTypeHtmlEntityFormController.php b/modules/schemadotorg_additional_type/src/Controller/SchemaDotOrgAdditionalTypeHtmlEntityFormController.php
index f0e885b11..7b616711f 100644
--- a/modules/schemadotorg_additional_type/src/Controller/SchemaDotOrgAdditionalTypeHtmlEntityFormController.php
+++ b/modules/schemadotorg_additional_type/src/Controller/SchemaDotOrgAdditionalTypeHtmlEntityFormController.php
@@ -125,8 +125,10 @@ class SchemaDotOrgAdditionalTypeHtmlEntityFormController extends FormController
     ];
     return [
       '#theme' => 'links',
-      '#prefix' => '<h2>' . $this->t('Please select the %item type you want to @action.', $t_args) . '</h2>',
+      '#title' => $this->t('Please select the %item type you want to @action.', $t_args),
       '#links' => $links,
+      '#prefix' => '<br/>',
+      '#suffix' => '<br/>',
       '#cache' => [
         'contexts' => ['url.query_args:' . $field_name],
       ],
diff --git a/modules/schemadotorg_additional_type/tests/src/Functional/SchemaDotOrgAdditionalTypeTest.php b/modules/schemadotorg_additional_type/tests/src/Functional/SchemaDotOrgAdditionalTypeTest.php
index fb0141365..630c9e360 100644
--- a/modules/schemadotorg_additional_type/tests/src/Functional/SchemaDotOrgAdditionalTypeTest.php
+++ b/modules/schemadotorg_additional_type/tests/src/Functional/SchemaDotOrgAdditionalTypeTest.php
@@ -141,16 +141,14 @@ class SchemaDotOrgAdditionalTypeTest extends SchemaDotOrgBrowserTestBase {
 
     // Check that create node displays the additional type selection page.
     $this->drupalGet('/node/add/event');
-    $assert->responseContains('<h1>Create Event</h1>');
-    $assert->responseContains('<h2>Please select the <em class="placeholder">Event</em> type you want to create.</h2>');
+    $assert->responseContains('<h1>Please select the <em class="placeholder">Event</em> type you want to create.</h1>');
     $assert->linkExists('Business Event');
     $assert->linkByHrefExists('/node/add/event?schema_event_type=BusinessEvent');
     $assert->fieldNotExists('schema_event_type');
 
     // Check that create node displays the form when additional type is defined.
     $this->drupalGet('/node/add/event', ['query' => ['schema_event_type' => 'BusinessEvent']]);
-    $assert->responseContains('<h1>Create Business Event</h1>');
-    $assert->responseNotContains('<h2>Please select the <em class="placeholder">Event</em> type you want to create.</h2>');
+    $assert->responseNotContains('<h1>Please select the <em class="placeholder">Event</em> type you want to create.</h1>');
     $assert->linkNotExists('Business Event');
     $assert->linkByHrefNotExists('/node/add/event?schema_event_type=BusinessEvent');
     $assert->fieldNotExists('schema_event_type');
@@ -176,7 +174,7 @@ class SchemaDotOrgAdditionalTypeTest extends SchemaDotOrgBrowserTestBase {
     $this->drupalGet($event_node->toUrl('edit-form'), ['query' => ['schema_event_type' => '']]);
     $assert->fieldNotExists('schema_event_type');
     $assert->linkNotExists('Change type');
-    $assert->responseContains('<h2>Please select the <em class="placeholder">Event</em> type you want to change to.</h2>');
+    $assert->responseContains('<h1>Please select the <em class="placeholder">Event</em> type you want to change to.</h1>');
     $assert->linkExists('Childrens Event');
     $assert->linkByHrefExists($event_node->toUrl('edit-form')->toString() . '?schema_event_type=ChildrensEvent');
 
-- 
GitLab