From fc4f5cca2180a952a54784c47d19b5ca2ce4b72f Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Tue, 30 Aug 2016 11:53:54 +0100
Subject: [PATCH] Issue #2734983 by Nikhilesh Gupta, neerajsingh, dimaro,
 mayurjadhav: Remove deprecated SafeMarkup::checkPlain usages from core

---
 core/includes/form.inc                                 | 10 +++++-----
 .../views/src/Plugin/views/field/FieldPluginBase.php   |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/core/includes/form.inc b/core/includes/form.inc
index d44f404cc2f2..a2a87ba1c6f8 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -568,7 +568,7 @@ function template_preprocess_form_element_label(&$variables) {
  * Note: if the batch 'title', 'init_message', 'progress_message', or
  * 'error_message' could contain any user input, it is the responsibility of
  * the code calling batch_set() to sanitize them first with a function like
- * \Drupal\Component\Utility\SafeMarkup::checkPlain() or
+ * \Drupal\Component\Utility\Html::escape() or
  * \Drupal\Component\Utility\Xss::filter(). Furthermore, if the batch operation
  * returns any user input in the 'results' or 'message' keys of $context, it
  * must also sanitize them first.
@@ -596,8 +596,8 @@ function template_preprocess_form_element_label(&$variables) {
  *   $nodes = \Drupal::entityTypeManager()->getStorage('node')
  *     ->loadByProperties(['uid' => $uid, 'type' => $type]);
  *   $node = reset($nodes);
- *   $context['results'][] = $node->id() . ' : ' . SafeMarkup::checkPlain($node->label());
- *   $context['message'] = SafeMarkup::checkPlain($node->label());
+ *   $context['results'][] = $node->id() . ' : ' . Html::escape($node->label());
+ *   $context['message'] = Html::escape($node->label());
  * }
  *
  * // A more advanced example is a multi-step operation that loads all rows,
@@ -616,10 +616,10 @@ function template_preprocess_form_element_label(&$variables) {
  *     ->range(0, $limit)
  *     ->execute();
  *   foreach ($result as $row) {
- *     $context['results'][] = $row->id . ' : ' . SafeMarkup::checkPlain($row->title);
+ *     $context['results'][] = $row->id . ' : ' . Html::escape($row->title);
  *     $context['sandbox']['progress']++;
  *     $context['sandbox']['current_id'] = $row->id;
- *     $context['message'] = SafeMarkup::checkPlain($row->title);
+ *     $context['message'] = Html::escape($row->title);
  *   }
  *   if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
  *     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
index cde5ecb35e47..b4f7e08dfa2b 100644
--- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
@@ -1362,7 +1362,7 @@ protected function renderAsLink($alter, $text, $tokens) {
     if ($path != '<front>') {
       // Use strip_tags as there should never be HTML in the path.
       // However, we need to preserve special characters like " that were
-      // removed by SafeMarkup::checkPlain().
+      // removed by Html::escape().
       $path = Html::decodeEntities($this->viewsTokenReplace($alter['path'], $tokens));
 
       // Tokens might contain <front>, so check for <front> again.
@@ -1562,7 +1562,7 @@ public function getRenderTokens($item) {
 
       // Use strip tags as there should never be HTML in the path.
       // However, we need to preserve special characters like " that
-      // were removed by SafeMarkup::checkPlain().
+      // were removed by Html::escape().
       $tokens["{{ raw_arguments.$arg }}"] = isset($this->view->args[$count]) ? strip_tags(Html::decodeEntities($this->view->args[$count])) : '';
       $count++;
     }
-- 
GitLab