HTMLRestrictionsUtilities
final class HTMLRestrictionsUtilities (View source)
| internal |
Utilities for interacting with HTML restrictions.
Constants
| private WILDCARD_ELEMENT_METHODS |
Wildcard types, and the methods that return tags the wildcard represents. |
Methods
Formats HTML elements for display.
Parses a HTML restrictions string with >=1 tags in an array of single tags.
Parses an HTML string into an array structured as expected by filter_html.
Cleans unwanted artifacts from "allowed HTML" arrays.
Adds allowed attributes to the elements array.
Compares two HTML restrictions.
Parses a HTML restrictions string into htmlSupport plugin config structure.
Returns the tags that match the provided wildcard.
Details
static array
toReadableElements(array $elements)
Formats HTML elements for display.
static array
allowedElementsStringToPluginElementsArray(string $elements_string)
Parses a HTML restrictions string with >=1 tags in an array of single tags.
static array
allowedElementsStringToHtmlFilterArray(string $elements_string)
Parses an HTML string into an array structured as expected by filter_html.
static array
cleanAllowedHtmlArray(array $elements)
Cleans unwanted artifacts from "allowed HTML" arrays.
static void
addAllowedAttributeToElements(array $elements, string $tag, string $attribute, array|true $value)
Adds allowed attributes to the elements array.
static array
diffAllowedElements(array $elements_array_1, array $elements_array_2)
Compares two HTML restrictions.
The structure of the arrays is the same as the allowed tags array documented in FilterInterface::getHTMLRestrictions().
static array
allowedElementsStringToHtmlSupportConfig(string $elements_string)
Parses a HTML restrictions string into htmlSupport plugin config structure.
static array
getWildcardTags(string $wildcard)
Returns the tags that match the provided wildcard.
A wildcard tag in element config is a way of representing multiple tags
with a single item, such as <$block> to represent all block tags. Each
wildcard should have a corresponding callback method listed in
WILDCARD_ELEMENT_METHODS that returns the set of tags represented by the
wildcard.