Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / lib / Drupal / Component / Render / PlainTextOutput.php
1 <?php
2
3 namespace Drupal\Component\Render;
4
5 use Drupal\Component\Utility\Html;
6
7 /**
8  * Provides an output strategy for transforming HTML into simple plain text.
9  *
10  * Use this when rendering a given HTML string into a plain text string that
11  * does not need special formatting, such as a label or an email subject.
12  *
13  * Returns a string with HTML tags stripped and HTML entities decoded suitable
14  * for email or other non-HTML contexts.
15  */
16 class PlainTextOutput implements OutputStrategyInterface {
17
18   /**
19    * {@inheritdoc}
20    */
21   public static function renderFromHtml($string) {
22     return Html::decodeEntities(strip_tags((string) $string));
23   }
24
25 }