Mercurial > hg > isophonics-drupal-site
annotate core/lib/Drupal/Component/Render/OutputStrategyInterface.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Component\Render; |
Chris@0 | 4 |
Chris@0 | 5 /** |
Chris@0 | 6 * Provides an output strategy that formats HTML strings for a given context. |
Chris@0 | 7 * |
Chris@0 | 8 * Output strategies assist in transforming HTML strings into strings that are |
Chris@0 | 9 * appropriate for a given context (e.g. plain-text), through performing the |
Chris@0 | 10 * relevant formatting. No sanitization is applied. |
Chris@0 | 11 */ |
Chris@0 | 12 interface OutputStrategyInterface { |
Chris@0 | 13 |
Chris@0 | 14 /** |
Chris@0 | 15 * Transforms a given HTML string into to a context-appropriate output string. |
Chris@0 | 16 * |
Chris@0 | 17 * This transformation consists of performing the formatting appropriate to |
Chris@0 | 18 * a given output context (e.g., plain-text email subjects, HTML attribute |
Chris@0 | 19 * values). |
Chris@0 | 20 * |
Chris@0 | 21 * @param string|object $string |
Chris@0 | 22 * An HTML string or an object with a ::__toString() magic method returning |
Chris@0 | 23 * HTML markup. The source HTML markup is considered ready for output into |
Chris@0 | 24 * HTML fragments and thus already properly escaped and sanitized. |
Chris@0 | 25 * |
Chris@0 | 26 * @return string |
Chris@0 | 27 * A new string that is formatted according to the output strategy. |
Chris@0 | 28 */ |
Chris@0 | 29 public static function renderFromHtml($string); |
Chris@0 | 30 |
Chris@0 | 31 } |