Cannot add <svg> to the Confirmation message

Created on 19 June 2025, 18 days ago

Problem/Motivation

I want to add some SVG icons to my confirmation message. The message gets saved correctly but when it supposed to be displayed it doesn't work.

I tried implementing the following hook but it did not solve.

function cty_webform_preprocess_webform_html_editor_markup(array &$variables) {
  // Ensure #allowed_tags is defined as an array.
  $allowed_tags = $variables['content']['#allowed_tags'] ?? [];

  // Add 'svg' tag only if it's not already present.
  if (!in_array('svg', $allowed_tags, true)) {
    $allowed_tags[] = 'svg';
  }
  if (!in_array('path', $allowed_tags, true)) {
    $allowed_tags[] = 'path';
  }

  $variables['content']['#allowed_tags'] = $allowed_tags;
}

The only solution was to add the 'svg' and 'path' to the WebformXss::getAdminTagList

πŸ› Bug report
Status

Active

Version

6.2

Component

Code

Created by

πŸ‡§πŸ‡·Brazil carolpettirossi Campinas - SP

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024