3 namespace Drupal\Component\Render;
5 use Drupal\Component\Utility\Html;
8 * Provides an output strategy for transforming HTML into simple plain text.
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.
13 * Returns a string with HTML tags stripped and HTML entities decoded suitable
14 * for email or other non-HTML contexts.
16 class PlainTextOutput implements OutputStrategyInterface {
21 public static function renderFromHtml($string) {
22 return Html::decodeEntities(strip_tags((string) $string));