Commit e5809400 authored by catch's avatar catch

Issue #2559605 by Cottser, stefan.r: Convert SafeMarkup::checkPlain() in...

Issue #2559605 by Cottser, stefan.r: Convert SafeMarkup::checkPlain() in render arrays to #plain_text
parent b833f73b
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace Drupal\Core\Block; namespace Drupal\Core\Block;
use Drupal\block\BlockInterface; use Drupal\block\BlockInterface;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResult;
use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
...@@ -166,7 +165,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta ...@@ -166,7 +165,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
$form['admin_label'] = array( $form['admin_label'] = array(
'#type' => 'item', '#type' => 'item',
'#title' => $this->t('Block description'), '#title' => $this->t('Block description'),
'#markup' => SafeMarkup::checkPlain($definition['admin_label']), '#plain_text' => $definition['admin_label'],
); );
$form['label'] = array( $form['label'] = array(
'#type' => 'textfield', '#type' => 'textfield',
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter; namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Component\Utility\SafeMarkup;
/** /**
* Plugin implementation of the 'entity reference ID' formatter. * Plugin implementation of the 'entity reference ID' formatter.
...@@ -33,7 +32,7 @@ public function viewElements(FieldItemListInterface $items) { ...@@ -33,7 +32,7 @@ public function viewElements(FieldItemListInterface $items) {
foreach ($this->getEntitiesToView($items) as $delta => $entity) { foreach ($this->getEntitiesToView($items) as $delta => $entity) {
if ($entity->id()) { if ($entity->id()) {
$elements[$delta] = array( $elements[$delta] = array(
'#markup' => SafeMarkup::checkPlain($entity->id()), '#plain_text' => $entity->id(),
// Create a cache tag entry for the referenced entity. In the case // Create a cache tag entry for the referenced entity. In the case
// that the referenced entity is deleted, the cache for referring // that the referenced entity is deleted, the cache for referring
// entities must be cleared. // entities must be cleared.
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter; namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException; use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
...@@ -98,7 +97,7 @@ public function viewElements(FieldItemListInterface $items) { ...@@ -98,7 +97,7 @@ public function viewElements(FieldItemListInterface $items) {
} }
} }
else { else {
$elements[$delta] = array('#markup' => SafeMarkup::checkPlain($label)); $elements[$delta] = array('#plain_text' => $label);
} }
$elements[$delta]['#cache']['tags'] = $entity->getCacheTags(); $elements[$delta]['#cache']['tags'] = $entity->getCacheTags();
} }
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Html;
use Drupal\Component\Serialization\Json; use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityStorageInterface;
...@@ -261,7 +260,7 @@ protected function buildBlocksForm() { ...@@ -261,7 +260,7 @@ protected function buildBlocksForm() {
$form[$entity_id]['#attributes']['class'][] = 'js-block-placed'; $form[$entity_id]['#attributes']['class'][] = 'js-block-placed';
} }
$form[$entity_id]['info'] = array( $form[$entity_id]['info'] = array(
'#markup' => SafeMarkup::checkPlain($info['label']), '#plain_text' => $info['label'],
'#wrapper_attributes' => array( '#wrapper_attributes' => array(
'class' => array('block'), 'class' => array('block'),
), ),
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace Drupal\block\Tests; namespace Drupal\block\Tests;
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Form\FormState; use Drupal\Core\Form\FormState;
use Drupal\simpletest\KernelTestBase; use Drupal\simpletest\KernelTestBase;
use Drupal\block\BlockInterface; use Drupal\block\BlockInterface;
...@@ -73,7 +72,7 @@ public function testBlockInterface() { ...@@ -73,7 +72,7 @@ public function testBlockInterface() {
'admin_label' => array( 'admin_label' => array(
'#type' => 'item', '#type' => 'item',
'#title' => t('Block description'), '#title' => t('Block description'),
'#markup' => SafeMarkup::checkPlain($definition['admin_label']), '#plain_text' => $definition['admin_label'],
), ),
'label' => array( 'label' => array(
'#type' => 'textfield', '#type' => 'textfield',
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder; use Drupal\Core\Entity\EntityViewBuilder;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Mail\MailFormatHelper; use Drupal\Core\Mail\MailFormatHelper;
use Drupal\Core\Render\Element; use Drupal\Core\Render\Element;
...@@ -42,7 +41,7 @@ public function buildComponents(array &$build, array $entities, array $displays, ...@@ -42,7 +41,7 @@ public function buildComponents(array &$build, array $entities, array $displays,
$build[$id]['message'] = array( $build[$id]['message'] = array(
'#type' => 'item', '#type' => 'item',
'#title' => t('Message'), '#title' => t('Message'),
'#markup' => SafeMarkup::checkPlain($entity->getMessage()), '#plain_text' => $entity->getMessage(),
); );
} }
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* The content translation administration forms. * The content translation administration forms.
*/ */
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Config\Entity\ThirdPartySettingsInterface; use Drupal\Core\Config\Entity\ThirdPartySettingsInterface;
use Drupal\Core\Entity\ContentEntityTypeInterface; use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeInterface;
...@@ -216,10 +215,10 @@ function _content_translation_preprocess_language_content_settings_table(&$varia ...@@ -216,10 +215,10 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
'bundle' => array( 'bundle' => array(
'#prefix' => '<span class="visually-hidden">', '#prefix' => '<span class="visually-hidden">',
'#suffix' => '</span> ', '#suffix' => '</span> ',
'#markup' => SafeMarkup::checkPlain($element[$bundle]['settings']['#label']), '#plain_text' => $element[$bundle]['settings']['#label'],
), ),
'field' => array( 'field' => array(
'#markup' => SafeMarkup::checkPlain($field_element['#label']), '#plain_text' => $field_element['#label'],
), ),
), ),
'class' => array('field'), 'class' => array('field'),
...@@ -250,15 +249,15 @@ function _content_translation_preprocess_language_content_settings_table(&$varia ...@@ -250,15 +249,15 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
'bundle' => array( 'bundle' => array(
'#prefix' => '<span class="visually-hidden">', '#prefix' => '<span class="visually-hidden">',
'#suffix' => '</span> ', '#suffix' => '</span> ',
'#markup' => SafeMarkup::checkPlain($element[$bundle]['settings']['#label']), '#plain_text' => $element[$bundle]['settings']['#label'],
), ),
'field' => array( 'field' => array(
'#prefix' => '<span class="visually-hidden">', '#prefix' => '<span class="visually-hidden">',
'#suffix' => '</span> ', '#suffix' => '</span> ',
'#markup' => SafeMarkup::checkPlain($field_element['#label']), '#plain_text' => $field_element['#label'],
), ),
'columns' => array( 'columns' => array(
'#markup' => SafeMarkup::checkPlain($column_label), '#plain_text' => $column_label,
), ),
), ),
'class' => array('column'), 'class' => array('column'),
......
...@@ -174,7 +174,7 @@ public function testIdFormatter() { ...@@ -174,7 +174,7 @@ public function testIdFormatter() {
$formatter = 'entity_reference_entity_id'; $formatter = 'entity_reference_entity_id';
$build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter); $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter);
$this->assertEqual($build[0]['#markup'], $this->referencedEntity->id(), sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter)); $this->assertEqual($build[0]['#plain_text'], $this->referencedEntity->id(), sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
$this->assertEqual($build[0]['#cache']['tags'], $this->referencedEntity->getCacheTags(), sprintf('The %s formatter has the expected cache tags.', $formatter)); $this->assertEqual($build[0]['#cache']['tags'], $this->referencedEntity->getCacheTags(), sprintf('The %s formatter has the expected cache tags.', $formatter));
$this->assertTrue(!isset($build[1]), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter)); $this->assertTrue(!isset($build[1]), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
} }
...@@ -244,7 +244,7 @@ public function testLabelFormatter() { ...@@ -244,7 +244,7 @@ public function testLabelFormatter() {
// The second referenced entity is "autocreated", therefore not saved and // The second referenced entity is "autocreated", therefore not saved and
// lacking any URL info. // lacking any URL info.
$expected_item_2 = array( $expected_item_2 = array(
'#markup' => $this->unsavedReferencedEntity->label(), '#plain_text' => $this->unsavedReferencedEntity->label(),
'#cache' => array( '#cache' => array(
'contexts' => [ 'contexts' => [
'user.permissions', 'user.permissions',
...@@ -257,8 +257,8 @@ public function testLabelFormatter() { ...@@ -257,8 +257,8 @@ public function testLabelFormatter() {
// Test with the 'link' setting set to FALSE. // Test with the 'link' setting set to FALSE.
$build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter, array('link' => FALSE)); $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter, array('link' => FALSE));
$this->assertEqual($build[0]['#markup'], $this->referencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter)); $this->assertEqual($build[0]['#plain_text'], $this->referencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
$this->assertEqual($build[1]['#markup'], $this->unsavedReferencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter)); $this->assertEqual($build[1]['#plain_text'], $this->unsavedReferencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
// Test an entity type that doesn't have any link templates, which means // Test an entity type that doesn't have any link templates, which means
// \Drupal\Core\Entity\EntityInterface::urlInfo() will throw an exception // \Drupal\Core\Entity\EntityInterface::urlInfo() will throw an exception
...@@ -273,7 +273,7 @@ public function testLabelFormatter() { ...@@ -273,7 +273,7 @@ public function testLabelFormatter() {
$referenced_entity_with_no_link_template->save(); $referenced_entity_with_no_link_template->save();
$build = $this->buildRenderArray([$referenced_entity_with_no_link_template], $formatter, array('link' => TRUE)); $build = $this->buildRenderArray([$referenced_entity_with_no_link_template], $formatter, array('link' => TRUE));
$this->assertEqual($build[0]['#markup'], $referenced_entity_with_no_link_template->label(), sprintf('The markup returned by the %s formatter is correct for an entity type with no valid link template.', $formatter)); $this->assertEqual($build[0]['#plain_text'], $referenced_entity_with_no_link_template->label(), sprintf('The markup returned by the %s formatter is correct for an entity type with no valid link template.', $formatter));
} }
/** /**
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Component\Plugin\Factory\DefaultFactory;
use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\PluginManagerBase;
use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityWithPluginCollectionInterface; use Drupal\Core\Entity\EntityWithPluginCollectionInterface;
...@@ -290,7 +289,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, arr ...@@ -290,7 +289,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, arr
'defaultPlugin' => $this->getDefaultPlugin($field_definition->getType()), 'defaultPlugin' => $this->getDefaultPlugin($field_definition->getType()),
), ),
'human_name' => array( 'human_name' => array(
'#markup' => SafeMarkup::checkPlain($label), '#plain_text' => $label,
), ),
'weight' => array( 'weight' => array(
'#type' => 'textfield', '#type' => 'textfield',
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\image\ConfigurableImageEffectInterface; use Drupal\image\ConfigurableImageEffectInterface;
use Drupal\image\ImageEffectManager; use Drupal\image\ImageEffectManager;
use Drupal\Component\Utility\SafeMarkup;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
...@@ -99,7 +98,7 @@ public function form(array $form, FormStateInterface $form_state) { ...@@ -99,7 +98,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#tree' => FALSE, '#tree' => FALSE,
'data' => array( 'data' => array(
'label' => array( 'label' => array(
'#markup' => SafeMarkup::checkPlain($effect->label()), '#plain_text' => $effect->label(),
), ),
), ),
); );
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* Administration functions for language.module. * Administration functions for language.module.
*/ */
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Render\Element; use Drupal\Core\Render\Element;
use Drupal\Core\Template\Attribute; use Drupal\Core\Template\Attribute;
use Drupal\Core\Url; use Drupal\Core\Url;
...@@ -170,7 +169,7 @@ function template_preprocess_language_content_settings_table(&$variables) { ...@@ -170,7 +169,7 @@ function template_preprocess_language_content_settings_table(&$variables) {
'data' => array( 'data' => array(
'#prefix' => '<label>', '#prefix' => '<label>',
'#suffix' => '</label>', '#suffix' => '</label>',
'#markup' => SafeMarkup::checkPlain($element[$bundle]['settings']['#label']), '#plain_text' => $element[$bundle]['settings']['#label'],
), ),
'class' => array('bundle'), 'class' => array('bundle'),
), ),
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\link\Plugin\Field\FieldFormatter; namespace Drupal\link\Plugin\Field\FieldFormatter;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldDefinitionInterface;
...@@ -201,7 +200,7 @@ public function viewElements(FieldItemListInterface $items) { ...@@ -201,7 +200,7 @@ public function viewElements(FieldItemListInterface $items) {
if (!empty($settings['url_only']) && !empty($settings['url_plain'])) { if (!empty($settings['url_only']) && !empty($settings['url_plain'])) {
$element[$delta] = array( $element[$delta] = array(
'#markup' => SafeMarkup::checkPlain($link_title), '#plain_text' => $link_title,
); );
if (!empty($item->_attributes)) { if (!empty($item->_attributes)) {
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\rest\Plugin\views\display; namespace Drupal\rest\Plugin\views\display;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\CacheableResponse; use Drupal\Core\Cache\CacheableResponse;
use Drupal\Core\Render\RenderContext; use Drupal\Core\Render\RenderContext;
...@@ -318,11 +317,12 @@ public function render() { ...@@ -318,11 +317,12 @@ public function render() {
$this->view->element['#content_type'] = $this->getMimeType(); $this->view->element['#content_type'] = $this->getMimeType();
$this->view->element['#cache_properties'][] = '#content_type'; $this->view->element['#cache_properties'][] = '#content_type';
// Wrap the output in a pre tag if this is for a live preview. // Encode and wrap the output in a pre tag if this is for a live preview.
if (!empty($this->view->live_preview)) { if (!empty($this->view->live_preview)) {
$build['#prefix'] = '<pre>'; $build['#prefix'] = '<pre>';
$build['#markup'] = SafeMarkup::checkPlain($build['#markup']); $build['#plain_text'] = $build['#markup'];
$build['#suffix'] = '</pre>'; $build['#suffix'] = '</pre>';
unset($build['#markup']);
} }
elseif ($this->view->getRequest()->getFormat($this->view->element['#content_type']) !== 'html') { elseif ($this->view->getRequest()->getFormat($this->view->element['#content_type']) !== 'html') {
// This display plugin is primarily for returning non-HTML formats. // This display plugin is primarily for returning non-HTML formats.
......
...@@ -480,16 +480,16 @@ public function testLivePreview() { ...@@ -480,16 +480,16 @@ public function testLivePreview() {
$entities[] = $row->_entity; $entities[] = $row->_entity;
} }
$expected = Html::escape($serializer->serialize($entities, 'json')); $expected = $serializer->serialize($entities, 'json');
$view->live_preview = TRUE; $view->live_preview = TRUE;
$build = $view->preview(); $build = $view->preview();
$rendered_json = $build['#markup']; $rendered_json = $build['#plain_text'];
$this->assertEqual($rendered_json, $expected, 'Ensure the previewed json is escaped.'); $this->assertTrue(!isset($build['#markup']) && $rendered_json == $expected, 'Ensure the previewed json is escaped.');
$view->destroy(); $view->destroy();
$expected = Html::escape($serializer->serialize($entities, 'xml')); $expected = $serializer->serialize($entities, 'xml');
// Change the request format to xml. // Change the request format to xml.
$view->setDisplay('rest_export_1'); $view->setDisplay('rest_export_1');
...@@ -505,7 +505,7 @@ public function testLivePreview() { ...@@ -505,7 +505,7 @@ public function testLivePreview() {
$this->executeView($view); $this->executeView($view);
$build = $view->preview(); $build = $view->preview();
$rendered_xml = $build['#markup']; $rendered_xml = $build['#plain_text'];
$this->assertEqual($rendered_xml, $expected, 'Ensure we preview xml when we change the request format.'); $this->assertEqual($rendered_xml, $expected, 'Ensure we preview xml when we change the request format.');
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace Drupal\simpletest\Form; namespace Drupal\simpletest\Form;
use Drupal\Component\Utility\SortArray; use Drupal\Component\Utility\SortArray;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\RendererInterface; use Drupal\Core\Render\RendererInterface;
...@@ -179,7 +178,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ...@@ -179,7 +178,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
); );
$form['tests'][$class]['description'] = array( $form['tests'][$class]['description'] = array(
'#prefix' => '<div class="description">', '#prefix' => '<div class="description">',
'#markup' => SafeMarkup::checkPlain($info['description']), '#plain_text' => $info['description'],
'#suffix' => '</div>', '#suffix' => '</div>',
'#wrapper_attributes' => array( '#wrapper_attributes' => array(
'class' => array('simpletest-test-description', 'table-filter-text-source'), 'class' => array('simpletest-test-description', 'table-filter-text-source'),
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\entity_test; namespace Drupal\entity_test;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder; use Drupal\Core\Entity\EntityViewBuilder;
...@@ -36,7 +35,7 @@ public function buildComponents(array &$build, array $entities, array $displays, ...@@ -36,7 +35,7 @@ public function buildComponents(array &$build, array $entities, array $displays,
foreach ($entities as $id => $entity) { foreach ($entities as $id => $entity) {
$build[$id]['label'] = array( $build[$id]['label'] = array(
'#weight' => -100, '#weight' => -100,
'#markup' => SafeMarkup::checkPlain($entity->label()), '#plain_text' => $entity->label(),
); );
$build[$id]['separator'] = array( $build[$id]['separator'] = array(
'#weight' => -150, '#weight' => -150,
...@@ -44,7 +43,7 @@ public function buildComponents(array &$build, array $entities, array $displays, ...@@ -44,7 +43,7 @@ public function buildComponents(array &$build, array $entities, array $displays,
); );
$build[$id]['view_mode'] = array( $build[$id]['view_mode'] = array(
'#weight' => -200, '#weight' => -200,
'#markup' => SafeMarkup::checkPlain($view_mode), '#plain_text' => $view_mode,
); );
} }
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\entity_test; namespace Drupal\entity_test;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
/** /**
...@@ -20,7 +19,7 @@ class EntityTestViewBuilderOverriddenView extends EntityTestViewBuilder { ...@@ -20,7 +19,7 @@ class EntityTestViewBuilderOverriddenView extends EntityTestViewBuilder {
*/ */
public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) { public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
$build = []; $build = [];
$build[$entity->id()]['#markup'] = SafeMarkup::checkPlain($entity->label()); $build[$entity->id()]['#plain_text'] = $entity->label();
return $build; return $build;
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
namespace Drupal\form_test\Form; namespace Drupal\form_test\Form;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
...@@ -57,7 +56,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ...@@ -57,7 +56,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
*/ */
function form_test_storage_page_cache_old_build_id($form) { function form_test_storage_page_cache_old_build_id($form) {
if (isset($form['#build_id_old'])) { if (isset($form['#build_id_old'])) {
$form['test_build_id_old']['#markup'] = SafeMarkup::checkPlain($form['#build_id_old']); $form['test_build_id_old']['#plain_text'] = $form['#build_id_old'];
} }
return $form; return $form;
} }
......
...@@ -99,7 +99,7 @@ public function preview() { ...@@ -99,7 +99,7 @@ public function preview() {
if (!empty($this->view->live_preview)) { if (!empty($this->view->live_preview)) {
$output = array( $output = array(
'#prefix' => '<pre>', '#prefix' => '<pre>',
'#markup' => SafeMarkup::checkPlain(drupal_render_root($output)),