3 namespace Drupal\Component\Render;
6 * Provides an output strategy that formats HTML strings for a given context.
8 * Output strategies assist in transforming HTML strings into strings that are
9 * appropriate for a given context (e.g. plain-text), through performing the
10 * relevant formatting. No sanitization is applied.
12 interface OutputStrategyInterface {
15 * Transforms a given HTML string into to a context-appropriate output string.
17 * This transformation consists of performing the formatting appropriate to
18 * a given output context (e.g., plain-text email subjects, HTML attribute
21 * @param string|object $string
22 * An HTML string or an object with a ::__toString() magic method returning
23 * HTML markup. The source HTML markup is considered ready for output into
24 * HTML fragments and thus already properly escaped and sanitized.
27 * A new string that is formatted according to the output strategy.
29 public static function renderFromHtml($string);