Skip to content
Snippets Groups Projects
Commit 36cbb14b authored by Claudiu Cristea's avatar Claudiu Cristea
Browse files

Merge branch '3490451-render-plain-deprecated' into '8.x-1.x'

Handle deprecation

See merge request !44
parents cc4b2ea9 f52f25ec
No related branches found
No related tags found
No related merge requests found
Pipeline #391040 failed
......@@ -289,7 +289,20 @@ class MessageTemplate extends ConfigEntityBundleBase implements MessageTemplateI
'#format' => $item['format'] ?? 'plain_text',
'#langcode' => $langcode,
];
$text[$key] = \Drupal::service('renderer')->renderPlain($build);
$renderInIsolation = function (array $build): MarkupInterface {
$renderer = \Drupal::getContainer()->get('renderer');
if (!method_exists('Drupal\Component\Utility\DeprecationHelper', 'backwardsCompatibleCall')) {
return $renderer->renderPlain($build);
}
return DeprecationHelper::backwardsCompatibleCall(
\Drupal::VERSION,
'10.3.0',
fn() => $renderer->renderInIsolation($build),
fn() => $renderer->renderPlain($build),
);
};
$text[$key] = $renderInIsolation($build);
}
if (isset($delta)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment