public static function Html::decodeEntities in Service Container 7
Same name and namespace in other branches
- 7.2 lib/Drupal/Component/Utility/Html.php \Drupal\Component\Utility\Html::decodeEntities()
Decodes all HTML entities including numerical ones to regular UTF-8 bytes.
Double-escaped entities will only be decoded once ("&lt;" becomes "<", not "<"). Be careful when using this function, as it will revert previous sanitization efforts (<script> will become <script>).
This method is not the opposite of Html::escape(). For example, this method will convert "é" to "é", whereas Html::escape() will not convert "é" to "é".
Parameters
string $text: The text to decode entities in.
Return value
string The input $text, with all HTML entities decoded once.
See also
\Drupal\Component\Utility\Html::escape()
1 call to Html::decodeEntities()
- UrlHelper::filterBadProtocol in lib/
Drupal/ Component/ Utility/ UrlHelper.php - Processes an HTML attribute value and strips dangerous protocols from URLs.
File
- lib/
Drupal/ Component/ Utility/ Html.php, line 368 - Contains \Drupal\Component\Utility\Html.
Class
- Html
- Provides DOMDocument helpers for parsing and serializing HTML strings.
Namespace
Drupal\Component\UtilityCode
public static function decodeEntities($text) {
return html_entity_decode($text, ENT_QUOTES, 'UTF-8');
}