public static SafeMarkup::checkPlain($text)
Encodes special characters in a plain-text string for display as HTML.
Also validates strings as UTF-8. All processed strings are also automatically flagged as safe markup strings for rendering.
string $text: The text to be checked or processed.
\Drupal\Component\Render\HtmlEscapedText An HtmlEscapedText object that escapes when rendered to string.
Will be removed before Drupal 9.0.0. Rely on Twig's auto-escaping feature, or use the #plain_text key when constructing a render array that contains plain text in order to use the renderer's auto-escaping feature. If neither of these are possible, \Drupal\Component\Utility\Html::escape() can be used in places where explicit escaping is needed.
public static function checkPlain($text) { return new HtmlEscapedText($text); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!SafeMarkup.php/function/SafeMarkup::checkPlain/8.1.x