You are here

class PlainTextOutput in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Component/Render/PlainTextOutput.php \Drupal\Component\Render\PlainTextOutput

Provides an output strategy for transforming HTML into simple plain text.

Use this when rendering a given HTML string into a plain text string that does not need special formatting, such as a label or an email subject.

Returns a string with HTML tags stripped and HTML entities decoded suitable for email or other non-HTML contexts.

Hierarchy

Expanded class hierarchy of PlainTextOutput

8 files declare their use of PlainTextOutput
Attribute.php in core/lib/Drupal/Core/Template/Attribute.php
Contains \Drupal\Core\Template\Attribute.
ContactPersonalTest.php in core/modules/contact/src/Tests/ContactPersonalTest.php
Contains \Drupal\contact\Tests\ContactPersonalTest.
EmailAction.php in core/modules/action/src/Plugin/Action/EmailAction.php
Contains \Drupal\action\Plugin\Action\EmailAction.
FileItem.php in core/modules/file/src/Plugin/Field/FieldType/FileItem.php
Contains \Drupal\file\Plugin\Field\FieldType\FileItem.
MailManager.php in core/lib/Drupal/Core/Mail/MailManager.php
Contains \Drupal\Core\Mail\MailManager.

... See full list

File

core/lib/Drupal/Component/Render/PlainTextOutput.php, line 20
Contains \Drupal\Component\Render\PlainTextOutput.

Namespace

Drupal\Component\Render
View source
class PlainTextOutput implements OutputStrategyInterface {

  /**
   * {@inheritdoc}
   */
  public static function renderFromHtml($string) {
    return Html::decodeEntities(strip_tags((string) $string));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PlainTextOutput::renderFromHtml public static function Transforms a given HTML string into to a context-appropriate output string. Overrides OutputStrategyInterface::renderFromHtml