From 7a7a5a851c494d5aac667609a53e4200cc8f181c Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 1 May 2023 17:11:50 +1000 Subject: [PATCH 1/2] [REF] Add in I18n front end translation support and update widget to be a RichTextEditor for the translation given it is already a wysiyg in singlelingual mode --- CRM/Campaign/DAO/Survey.php | 4 ++-- CRM/Core/I18n/SchemaStructure.php | 2 +- templates/CRM/Campaign/Form/Petition.tpl | 2 +- templates/CRM/Campaign/Form/Survey/Main.tpl | 2 +- xml/schema/Campaign/Survey.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CRM/Campaign/DAO/Survey.php b/CRM/Campaign/DAO/Survey.php index dd319d57726e..7acaf692e846 100644 --- a/CRM/Campaign/DAO/Survey.php +++ b/CRM/Campaign/DAO/Survey.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Campaign/Survey.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:4b2846e419f4a7d5dcc44b80df895caf) + * (GenCodeChecksum:79c05054f18c94059ec35314ea6bbef6) */ /** @@ -417,7 +417,7 @@ public static function &fields() { 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 1, 'html' => [ - 'type' => 'TextArea', + 'type' => 'RichTextEditor', ], 'add' => '3.3', ], diff --git a/CRM/Core/I18n/SchemaStructure.php b/CRM/Core/I18n/SchemaStructure.php index f8bd1e27dd07..765a8efd8351 100644 --- a/CRM/Core/I18n/SchemaStructure.php +++ b/CRM/Core/I18n/SchemaStructure.php @@ -330,7 +330,7 @@ public static function &widgets() { 'required' => "true", ], 'instructions' => [ - 'type' => "TextArea", + 'type' => "RichTextEditor", 'rows' => "20", 'cols' => "80", ], diff --git a/templates/CRM/Campaign/Form/Petition.tpl b/templates/CRM/Campaign/Form/Petition.tpl index 431e4cbe05d3..100cf4ef7a9f 100644 --- a/templates/CRM/Campaign/Form/Petition.tpl +++ b/templates/CRM/Campaign/Form/Petition.tpl @@ -32,7 +32,7 @@ {$form.title.html} - {$form.instructions.label} + {$form.instructions.label}{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_survey' field='instructions' id=$surveyId}{/if} {$form.instructions.html} diff --git a/templates/CRM/Campaign/Form/Survey/Main.tpl b/templates/CRM/Campaign/Form/Survey/Main.tpl index b861552d1f4e..6d16494f8176 100644 --- a/templates/CRM/Campaign/Form/Survey/Main.tpl +++ b/templates/CRM/Campaign/Form/Survey/Main.tpl @@ -33,7 +33,7 @@
{ts}Select the Activity Type.{/ts}
- {$form.instructions.label} + {$form.instructions.label}{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_survey' field='instructions' id=$surveyId}{/if} {$form.instructions.html} diff --git a/xml/schema/Campaign/Survey.xml b/xml/schema/Campaign/Survey.xml index 52990e58780e..4ec988168e71 100644 --- a/xml/schema/Campaign/Survey.xml +++ b/xml/schema/Campaign/Survey.xml @@ -106,7 +106,7 @@ true Script instructions for volunteers to use for the survey. - TextArea + RichTextEditor 20 80 From 7d7950754fa4813693ad5a2973d096283e920e02 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 2 May 2023 11:49:17 +1000 Subject: [PATCH 2/2] Add instructions field into the skip fields array --- CRM/Utils/API/HTMLInputCoder.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CRM/Utils/API/HTMLInputCoder.php b/CRM/Utils/API/HTMLInputCoder.php index 55dfffdd8e5e..8e8dca79c1e5 100644 --- a/CRM/Utils/API/HTMLInputCoder.php +++ b/CRM/Utils/API/HTMLInputCoder.php @@ -115,6 +115,8 @@ public function getSkipFields() { 'settings', // SearchSegment items 'items', + // Survey entity + 'instructions', ]; $custom = CRM_Core_DAO::executeQuery('SELECT id FROM civicrm_custom_field WHERE html_type = "RichTextEditor"'); while ($custom->fetch()) {