You are here

public static function YamlFormHtmlEditor::getAllowedContent in YAML Form 8

Get allowed content.

Return value

array Allowed content (tags) for CKEditor.

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

File

src/Element/YamlFormHtmlEditor.php, line 64

Class

YamlFormHtmlEditor
Provides a form element for entering HTML using CKEditor or CodeMirror.

Namespace

Drupal\yamlform\Element

Code

public static function getAllowedContent() {
  $allowed_tags = \Drupal::config('yamlform.settings')
    ->get('elements.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);
}