You are here

public static function WebformHtmlEditor::getAllowedContent in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Element/WebformHtmlEditor.php \Drupal\webform\Element\WebformHtmlEditor::getAllowedContent()

Get allowed content.

Return value

array Allowed content (tags) for CKEditor.

1 call to WebformHtmlEditor::getAllowedContent()
WebformHtmlEditor::processWebformHtmlEditor in src/Element/WebformHtmlEditor.php
Prepares a #type 'webform_html_editor' render element for input.html.twig.

File

src/Element/WebformHtmlEditor.php, line 183

Class

WebformHtmlEditor
Provides a webform element for entering HTML using CodeMirror, TextFormat, or custom CKEditor.

Namespace

Drupal\webform\Element

Code

public static function getAllowedContent() {
  $allowed_tags = \Drupal::config('webform.settings')
    ->get('element.allowed_tags');
  switch ($allowed_tags) {
    case 'admin':
      $allowed_tags = Xss::getAdminTagList();
      break;
    case 'html':
      $allowed_tags = Xss::getHtmlTagList();
      break;
    default:
      $allowed_tags = preg_split('/ +/', $allowed_tags);
      break;
  }
  foreach ($allowed_tags as $index => $allowed_tag) {
    $allowed_tags[$index] .= '(*)[*]{*}';
  }
  return implode('; ', $allowed_tags);
}