Commit 434b8234 authored by Adam Shepherd's avatar Adam Shepherd
Browse files

Issue #3276932 by AdamPS: Corruption of title that resembles HTML

parent b344a5c5
Loading
Loading
Loading
Loading
+6 −0
Changes for src/Plugin/Field/FieldFormatter/TitleFormatter.php: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\manage_display\Plugin\Field\FieldFormatter;

use Drupal\Component\Render\HtmlEscapedText;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\BasicStringFormatter;
use Drupal\Core\Form\FormStateInterface;
@@ -35,6 +36,11 @@ class TitleFormatter extends BasicStringFormatter {
        $url = $parent->isNew() ? Url::fromRoute('<front>') : $parent->toUrl();
        $text = Link::fromTextAndUrl($text, $url)->toString();
      }
      else {
        // Workaround bug https://www.drupal.org/project/drupal/issues/3274778.
        $text = new HtmlEscapedText($text);
      }

      $output[] = [
        '#type' => 'html_tag',
        '#tag' => $this->getSetting('tag'),