diff --git a/core/lib/Drupal/Core/Render/Render.php b/core/lib/Drupal/Core/Render/Render.php
index eef825b..5ef403a 100644
--- a/core/lib/Drupal/Core/Render/Render.php
+++ b/core/lib/Drupal/Core/Render/Render.php
@@ -431,7 +431,7 @@ protected static function setCache(&$markup, array $elements) {
* @return string
* The generated placeholder HTML.
*/
- protected static function getCachePlaceholder($callback, array $context, $token) {
+ public static function generateCachePlaceholder($callback, array $context, $token) {
// Serialize the context into a HTML attribute; unserializing is unnecessary.
$context_attribute = '';
foreach ($context as $key => $value) {
diff --git a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php
index 3584bbb..dd073d6 100644
--- a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php
+++ b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php
@@ -141,7 +141,7 @@ public function buildComponents(array &$build, array $entities, array $displays,
$context,
),
),
- '#markup' => drupal_render_cache_generate_placeholder($callback, $context, $context['token']),
+ '#markup' => Render::generateCachePlaceholder($callback, $context, $context['token']),
);
if (!isset($build[$id]['#attached'])) {
@@ -180,7 +180,7 @@ public function buildComponents(array &$build, array $entities, array $displays,
*/
public static function renderLinks(array $element, array $context) {
$callback = '\Drupal\comment\CommentViewBuilder::renderLinks';
- $placeholder = drupal_render_cache_generate_placeholder($callback, $context, $context['token']);
+ $placeholder = Render::generateCachePlaceholder($callback, $context, $context['token']);
$links = array(
'#theme' => 'links__comment',
'#pre_render' => array('drupal_pre_render_links'),
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
index 0e46fee..011c5c1 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
@@ -190,7 +190,7 @@ public function viewElements(FieldItemListInterface $items) {
$context,
),
),
- '#markup' => drupal_render_cache_generate_placeholder($callback, $context, $context['token']),
+ '#markup' => Render::generateCachePlaceholder($callback, $context, $context['token']),
);
}
}
@@ -224,7 +224,7 @@ public function viewElements(FieldItemListInterface $items) {
*/
public static function renderForm(array $element, array $context) {
$callback = '\Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::renderForm';
- $placeholder = drupal_render_cache_generate_placeholder($callback, $context, $context['token']);
+ $placeholder = Render::generateCachePlaceholder($callback, $context, $context['token']);
$entity = entity_load($context['entity_type'], $context['entity_id']);
$form = comment_add($entity, $context['field_name']);
// @todo: This only works as long as assets are still tracked in a global
diff --git a/core/modules/node/lib/Drupal/node/NodeViewBuilder.php b/core/modules/node/lib/Drupal/node/NodeViewBuilder.php
index 7b936e1..a429d0c 100644
--- a/core/modules/node/lib/Drupal/node/NodeViewBuilder.php
+++ b/core/modules/node/lib/Drupal/node/NodeViewBuilder.php
@@ -50,7 +50,7 @@ public function buildComponents(array &$build, array $entities, array $displays,
$context,
),
),
- '#markup' => drupal_render_cache_generate_placeholder($callback, $context, $context['token']),
+ '#markup' => Render::generateCachePlaceholder($callback, $context, $context['token']),
);
@@ -106,7 +106,7 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode, $langco
*/
public static function renderLinks(array $element, array $context) {
$callback = '\Drupal\node\NodeViewBuilder::renderLinks';
- $placeholder = drupal_render_cache_generate_placeholder($callback, $context, $context['token']);
+ $placeholder = Render::generateCachePlaceholder($callback, $context, $context['token']);
$links = array(
'#theme' => 'links__node',
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
index e8f6818..f612303 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
@@ -781,7 +781,7 @@ function testDrupalRenderRenderCachePlaceholder() {
$context
),
),
- '#markup' => drupal_render_cache_generate_placeholder($callback, $context, $context['token']),
+ '#markup' => Render::generateCachePlaceholder($callback, $context, $context['token']),
'#prefix' => '',
'#suffix' => ''
);
@@ -870,7 +870,7 @@ function testDrupalRenderChildElementRenderCachePlaceholder() {
$context
),
),
- '#markup' => drupal_render_cache_generate_placeholder($callback, $context, $context['token']),
+ '#markup' => Render::generateCachePlaceholder($callback, $context, $context['token']),
'#prefix' => '',
'#suffix' => ''
);
diff --git a/core/modules/system/tests/modules/common_test/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module
index 2785be9..47a6d21 100644
--- a/core/modules/system/tests/modules/common_test/common_test.module
+++ b/core/modules/system/tests/modules/common_test/common_test.module
@@ -5,6 +5,8 @@
* Helper module for the Common tests.
*/
+use Drupal\Core\Render\Render;
+
/**
* Applies #printed to an element to help test #pre_render.
*/
@@ -207,7 +209,7 @@ function common_test_post_render_cache(array $element, array $context) {
* A render array.
*/
function common_test_post_render_cache_placeholder(array $element, array $context) {
- $placeholder = drupal_render_cache_generate_placeholder(__FUNCTION__, $context, $context['token']);
+ $placeholder = Render::generateCachePlaceholder(__FUNCTION__, $context, $context['token']);
$replace_element = array(
'#markup' => '' . $context['bar'] . '',
'#attached' => array(