You are here

public static function FilterHtml::normalizeTags in Markdown 8.2

Normalizes allowed HTML tags.

Parameters

array $tags: The tags to normalize.

Return value

array The normalized allowed HTML tags.

3 calls to FilterHtml::normalizeTags()
FilterHtml::getHTMLRestrictions in src/Util/FilterHtml.php
Returns HTML allowed by this filter's configuration.
FilterHtml::mergeAllowedTags in src/Util/FilterHtml.php
Merges allowed HTML tags.
FilterHtml::tagsToString in src/Util/FilterHtml.php
Converts an array of tags (and their potential attributes) to a string.

File

src/Util/FilterHtml.php, line 137

Class

FilterHtml
Extends FilterHtml to allow more more permissive global attributes.

Namespace

Drupal\markdown\Util

Code

public static function normalizeTags(array $tags) {
  $tags = array_map(function ($attributes) {
    if (is_array($attributes)) {
      foreach ($attributes as $name => $value) {
        if (!is_bool($value)) {
          $attributes[$name] = is_array($value) ? $value : [
            $value => TRUE,
          ];
        }
      }
      return $attributes;
    }
    return $attributes === FALSE ? [] : [
      '*' => TRUE,
    ];
  }, $tags);
  ksort($tags);
  return $tags;
}