From 397c11f6c2eb02e07b8313372c3aee8a7e2d7833 Mon Sep 17 00:00:00 2001 From: Govind Malu Date: Mon, 18 Dec 2023 22:00:25 +0530 Subject: [PATCH] [CIVIC-1529] Fixed submit button arrow htmlentity. --- .../templates/form/input--submit.html.twig | 9 +++++---- web/themes/contrib/civictheme/includes/form.inc | 7 +++++++ .../templates/form/input--submit.html.twig | 12 +++++++----- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/web/themes/contrib/civictheme/civictheme_starter_kit/templates/form/input--submit.html.twig b/web/themes/contrib/civictheme/civictheme_starter_kit/templates/form/input--submit.html.twig index 97c2ddbb8..f85b46e2c 100644 --- a/web/themes/contrib/civictheme/civictheme_starter_kit/templates/form/input--submit.html.twig +++ b/web/themes/contrib/civictheme/civictheme_starter_kit/templates/form/input--submit.html.twig @@ -4,20 +4,21 @@ * CivicTheme implementation to display a 'submit' form element. * * Variables: + * - value: [string] value. * - attributes: [string] Additional attributes. * - modifier_class: [string] Additional classes. */ #} {% if 'secondary' in modifier_class %} - {% set type = 'secondary' %} + {% set type = 'secondary' %} {% else %} - {% set type = 'primary' %} + {% set type = 'primary' %} {% endif %} {% set children %} -{% include "@atoms/button/button.twig" with { + {% include "@atoms/button/button.twig" with { type: type, - text: attributes.value, + text: value, modifier_class: modifier_class, attributes: attributes, kind: 'submit', diff --git a/web/themes/contrib/civictheme/includes/form.inc b/web/themes/contrib/civictheme/includes/form.inc index 0bf648d28..feae2e640 100644 --- a/web/themes/contrib/civictheme/includes/form.inc +++ b/web/themes/contrib/civictheme/includes/form.inc @@ -45,6 +45,13 @@ function civictheme_preprocess_input(array &$variables): void { if (isset($variables['attributes']['#civictheme_theme'])) { unset($variables['attributes']['#civictheme_theme']); } + + // Fix htmlentity in submit button text. + $element = $variables['element']; + + if (isset($element['#type']) && $element['#type'] == 'submit' && !empty($variables['attributes']['value'])) { + $variables['value'] = $variables['attributes']['value']; + } } /** diff --git a/web/themes/contrib/civictheme/templates/form/input--submit.html.twig b/web/themes/contrib/civictheme/templates/form/input--submit.html.twig index 9351c4f7a..f85b46e2c 100644 --- a/web/themes/contrib/civictheme/templates/form/input--submit.html.twig +++ b/web/themes/contrib/civictheme/templates/form/input--submit.html.twig @@ -4,23 +4,25 @@ * CivicTheme implementation to display a 'submit' form element. * * Variables: + * - value: [string] value. * - attributes: [string] Additional attributes. * - modifier_class: [string] Additional classes. */ #} {% if 'secondary' in modifier_class %} - {% set type = 'secondary' %} + {% set type = 'secondary' %} {% else %} - {% set type = 'primary' %} + {% set type = 'primary' %} {% endif %} {% set children %} -{% include "@atoms/button/button.twig" with { + {% include "@atoms/button/button.twig" with { type: type, - text: attributes.value, + text: value, modifier_class: modifier_class, attributes: attributes, - kind: 'submit' + kind: 'submit', + theme: theme } only %} {% endset %} {% include "@molecules/form-element/form-element.twig" with {