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

Breadcrumb

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

function HtmlSerializerRules::escape

Overrides OutputRules::escape

File

core/lib/Drupal/Component/Utility/HtmlSerializerRules.php, line 28

Class

HtmlSerializerRules
Drupal-specific HTML5 serializer rules.

Namespace

Drupal\Component\Utility

Code

protected function escape($text, $attribute = FALSE) {
    $text = parent::escape($text, $attribute);
    if ($attribute) {
        $text = strtr($text, [
            '<' => '&lt;',
            '>' => '&gt;',
        ]);
    }
    return $text;
}

API Navigation

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