Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Html.php

function Html::decodeEntities

Decodes all HTML entities including numerical ones to regular UTF-8 bytes.

Double-escaped entities will only be decoded once ("&amp;lt;" becomes "&lt;", not "<"). Be careful when using this function, as it will revert previous sanitization efforts (&lt;script&gt; will become <script>).

This method is not the opposite of Html::escape(). For example, this method will convert "&eacute;" to "é", whereas Html::escape() will not convert "é" to "&eacute;".

Parameters

string $text: The text to decode entities in.

Return value

string The input $text, with all HTML entities decoded once.

See also

html_entity_decode()

\Drupal\Component\Utility\Html::escape()

27 calls to Html::decodeEntities()
BigPipe::sendPlaceholders in core/modules/big_pipe/src/Render/BigPipe.php
Sends BigPipe placeholders' replacements as embedded AJAX responses.
CommentForm::buildEntity in core/modules/comment/src/CommentForm.php
Builds an updated entity object based upon the submitted form values.
ContextualLinks::render in core/modules/contextual/src/Plugin/views/field/ContextualLinks.php
Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
DbLogController::overview in core/modules/dblog/src/Controller/DbLogController.php
Displays a listing of database log messages.
EntityAutocompleteMatcher::getMatches in core/lib/Drupal/Core/Entity/EntityAutocompleteMatcher.php
Gets matched labels based on a given search string.

... See full list

File

core/lib/Drupal/Component/Utility/Html.php, line 393

Class

Html
Provides DOMDocument helpers for parsing and serializing HTML strings.

Namespace

Drupal\Component\Utility

Code

public static function decodeEntities(string $text) : string {
    return html_entity_decode($text, ENT_QUOTES, 'UTF-8');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal