From 97e3a6fd965aa236f963b5fe6f55d855ebd73c93 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Samuli=20Sillanp=C3=A4=C3=A4?= <samuli.sillanpaa@gmail.com>
Date: Tue, 5 Feb 2019 20:58:54 +0200
Subject: [PATCH] Allow using HTML-markup in form element help text. (#1312)

---
 config/vufind/FeedbackForms.yaml                | 4 +++-
 themes/bootstrap3/templates/feedback/form.phtml | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/config/vufind/FeedbackForms.yaml b/config/vufind/FeedbackForms.yaml
index e7826a9e9f0..4bade384b80 100644
--- a/config/vufind/FeedbackForms.yaml
+++ b/config/vufind/FeedbackForms.yaml
@@ -41,7 +41,9 @@
 #     settings (array)   HTML attributes as key-value pairs, for example:
 #       - [class, "custom-css-class another-class"]
 #     type (string)      Element type (text|textarea|email|url|select|radio)
-#     help (string)      Element help text (translation key)
+#     help (string)      Element help text (translation key).
+#                        To include HTML formatting, use a translation key ending
+#                        in '_html' here, and define markup in the language files.
 #     
 #     And for select and radio elements:
 # 
diff --git a/themes/bootstrap3/templates/feedback/form.phtml b/themes/bootstrap3/templates/feedback/form.phtml
index 1c50916e297..d3f71da8b22 100644
--- a/themes/bootstrap3/templates/feedback/form.phtml
+++ b/themes/bootstrap3/templates/feedback/form.phtml
@@ -73,7 +73,7 @@
 
     <div class="form-group <?= $el['type'] ?>">
     <?php if (!empty($el['help'])): ?>
-      <p class="info"><?= $this->transEsc($el['help']) ?></p>
+      <p class="info"><?= substr($el['help'], -5) === '_html' ? $this->translate($el['help']) : $this->transEsc($el['help']) ?></p>
     <?php endif ?>
     <?php if ($el['type'] !== 'submit'): ?>
       <?php if ($el['type'] === 'radio'): ?>
-- 
GitLab