Commit ae3ee317 authored by xjm's avatar xjm

Issue #2704871 by pepegarciag, ieguskiza, snehi, gaurav.pahuja, rajeshwari10,...

Issue #2704871 by pepegarciag, ieguskiza, snehi, gaurav.pahuja, rajeshwari10, dimaro, gargsuchi, pashupathi nath gajawada, penyaskito, Manuel Garcia, Mile23: Replace usages of deprecated method drupal render()
parent e211a2ec
...@@ -896,7 +896,7 @@ function drupal_render_children(&$element, $children_keys = NULL) { ...@@ -896,7 +896,7 @@ function drupal_render_children(&$element, $children_keys = NULL) {
$output = ''; $output = '';
foreach ($children_keys as $key) { foreach ($children_keys as $key) {
if (!empty($element[$key])) { if (!empty($element[$key])) {
$output .= drupal_render($element[$key]); $output .= \Drupal::service('bare_html_page_renderer')->render($element[$key]);
} }
} }
return Markup::create($output); return Markup::create($output);
......
...@@ -53,7 +53,7 @@ function tablesort_header(&$cell_content, array &$cell_attributes, array $header ...@@ -53,7 +53,7 @@ function tablesort_header(&$cell_content, array &$cell_attributes, array $header
'#theme' => 'tablesort_indicator', '#theme' => 'tablesort_indicator',
'#style' => $ts['sort'], '#style' => $ts['sort'],
); );
$image = drupal_render($tablesort_indicator); $image = \Drupal::service('renderer')->render($tablesort_indicator);
} }
else { else {
// If the user clicks a different header, we want to sort ascending initially. // If the user clicks a different header, we want to sort ascending initially.
......
...@@ -120,7 +120,7 @@ function callback_batch_finished($success, $results, $operations) { ...@@ -120,7 +120,7 @@ function callback_batch_finished($success, $results, $operations) {
'#theme' => 'item_list', '#theme' => 'item_list',
'#items' => $results, '#items' => $results,
); );
$message .= drupal_render($list); $message .= \Drupal::service('renderer')->render($list);
drupal_set_message($message); drupal_set_message($message);
} }
else { else {
......
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
* // Finally, build a renderable array from the transformed tree. * // Finally, build a renderable array from the transformed tree.
* $menu = $menu_tree->build($tree); * $menu = $menu_tree->build($tree);
* *
* $menu_html = drupal_render($menu); * $menu_html = \Drupal::service('renderer')->render($menu);
* @endcode * @endcode
* *
* @} * @}
......
...@@ -159,7 +159,7 @@ public static function preRenderTableselect($element) { ...@@ -159,7 +159,7 @@ public static function preRenderTableselect($element) {
$row += $element['#options'][$key]['#attributes']; $row += $element['#options'][$key]['#attributes'];
} }
// Render the checkbox / radio element. // Render the checkbox / radio element.
$row['data'][] = drupal_render($element[$key]); $row['data'][] = \Drupal::service('renderer')->render($element[$key]);
// As table.html.twig only maps header and row columns by order, create // As table.html.twig only maps header and row columns by order, create
// the correct order by iterating over the header fields. // the correct order by iterating over the header fields.
......
...@@ -303,7 +303,7 @@ public function render($hook, array $variables) { ...@@ -303,7 +303,7 @@ public function render($hook, array $variables) {
unset($preprocess_bubbleable['#cache']['keys']); unset($preprocess_bubbleable['#cache']['keys']);
if ($preprocess_bubbleable) { if ($preprocess_bubbleable) {
// @todo Inject the Renderer in https://www.drupal.org/node/2529438. // @todo Inject the Renderer in https://www.drupal.org/node/2529438.
drupal_render($preprocess_bubbleable); \Drupal::service('renderer')->render($preprocess_bubbleable);
} }
} }
......
...@@ -166,7 +166,7 @@ function hook_tokens_alter(array &$replacements, array $context, \Drupal\Core\Re ...@@ -166,7 +166,7 @@ function hook_tokens_alter(array &$replacements, array $context, \Drupal\Core\Re
// of a field (field_title). // of a field (field_title).
if (isset($context['tokens']['title'])) { if (isset($context['tokens']['title'])) {
$title = $node->field_title->view('default'); $title = $node->field_title->view('default');
$replacements[$context['tokens']['title']] = drupal_render($title); $replacements[$context['tokens']['title']] = \Drupal::service('renderer')->render($title);
} }
} }
} }
......
...@@ -15,6 +15,6 @@ function action_views_form_substitutions() { ...@@ -15,6 +15,6 @@ function action_views_form_substitutions() {
'#attributes' => array('class' => array('action-table-select-all')), '#attributes' => array('class' => array('action-table-select-all')),
); );
return array( return array(
'<!--action-bulk-form-select-all-->' => drupal_render($select_all), '<!--action-bulk-form-select-all-->' => \Drupal::service('renderer')->render($select_all),
); );
} }
...@@ -437,7 +437,7 @@ function template_preprocess_book_navigation(&$variables) { ...@@ -437,7 +437,7 @@ function template_preprocess_book_navigation(&$variables) {
} }
if (!empty($build)) { if (!empty($build)) {
drupal_render($build); \Drupal::service('renderer')->render($build);
} }
$variables['has_links'] = FALSE; $variables['has_links'] = FALSE;
......
...@@ -220,7 +220,7 @@ protected function bookAdminTableTree(array $tree, array &$form) { ...@@ -220,7 +220,7 @@ protected function bookAdminTableTree(array $tree, array &$form) {
} }
$form[$id]['title'] = [ $form[$id]['title'] = [
'#prefix' => !empty($indentation) ? drupal_render($indentation) : '', '#prefix' => !empty($indentation) ? \Drupal::service('renderer')->render($indentation) : '',
'#type' => 'textfield', '#type' => 'textfield',
'#default_value' => $data['link']['title'], '#default_value' => $data['link']['title'],
'#maxlength' => 255, '#maxlength' => 255,
......
...@@ -631,7 +631,7 @@ function template_preprocess_comment(&$variables) { ...@@ -631,7 +631,7 @@ function template_preprocess_comment(&$variables) {
'#theme' => 'username', '#theme' => 'username',
'#account' => $account, '#account' => $account,
); );
$variables['author'] = drupal_render($username); $variables['author'] = \Drupal::service('renderer')->render($username);
$variables['author_id'] = $comment->getOwnerId(); $variables['author_id'] = $comment->getOwnerId();
$variables['new_indicator_timestamp'] = $comment->getChangedTime(); $variables['new_indicator_timestamp'] = $comment->getChangedTime();
$variables['created'] = format_date($comment->getCreatedTime()); $variables['created'] = format_date($comment->getCreatedTime());
...@@ -677,7 +677,7 @@ function template_preprocess_comment(&$variables) { ...@@ -677,7 +677,7 @@ function template_preprocess_comment(&$variables) {
'#theme' => 'username', '#theme' => 'username',
'#account' => $account_parent, '#account' => $account_parent,
); );
$variables['parent_author'] = drupal_render($username); $variables['parent_author'] = \Drupal::service('renderer')->render($username);
$variables['parent_created'] = format_date($comment_parent->getCreatedTime()); $variables['parent_created'] = format_date($comment_parent->getCreatedTime());
// Avoid calling format_date() twice on the same timestamp. // Avoid calling format_date() twice on the same timestamp.
if ($comment_parent->getChangedTime() == $comment_parent->getCreatedTime()) { if ($comment_parent->getChangedTime() == $comment_parent->getCreatedTime()) {
......
...@@ -72,7 +72,7 @@ public function render(ResultRow $values) { ...@@ -72,7 +72,7 @@ public function render(ResultRow $values) {
$entity = $this->getEntity($values); $entity = $this->getEntity($values);
// Only render the links, if they are defined. // Only render the links, if they are defined.
return !empty($this->build[$entity->id()]['links']['comment__comment']) ? drupal_render($this->build[$entity->id()]['links']['comment__comment']) : ''; return !empty($this->build[$entity->id()]['links']['comment__comment']) ? \Drupal::service('renderer')->render($this->build[$entity->id()]['links']['comment__comment']) : '';
} }
} }
...@@ -70,7 +70,7 @@ public function render(ResultRow $values) { ...@@ -70,7 +70,7 @@ public function render(ResultRow $values) {
'#theme' => 'username', '#theme' => 'username',
'#account' => $account, '#account' => $account,
); );
return drupal_render($username); return \Drupal::service('renderer')->render($username);
} }
else { else {
return $this->sanitizeValue($this->getValue($values)); return $this->sanitizeValue($this->getValue($values));
......
...@@ -209,7 +209,7 @@ function _content_translation_preprocess_language_content_settings_table(&$varia ...@@ -209,7 +209,7 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
$rows[] = array( $rows[] = array(
'data' => array( 'data' => array(
array( array(
'data' => drupal_render($field_element), 'data' => \Drupal::service('renderer')->render($field_element),
'class' => array('translatable'), 'class' => array('translatable'),
), ),
array( array(
...@@ -243,7 +243,7 @@ function _content_translation_preprocess_language_content_settings_table(&$varia ...@@ -243,7 +243,7 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
$rows[] = array( $rows[] = array(
'data' => array( 'data' => array(
array( array(
'data' => drupal_render($column_element[$key]), 'data' => \Drupal::service('renderer')->render($column_element[$key]),
'class' => array('translatable'), 'class' => array('translatable'),
), ),
array( array(
......
...@@ -138,7 +138,7 @@ public function render(ResultRow $values) { ...@@ -138,7 +138,7 @@ public function render(ResultRow $values) {
'#type' => 'contextual_links_placeholder', '#type' => 'contextual_links_placeholder',
'#id' => _contextual_links_to_id($contextual_links), '#id' => _contextual_links_to_id($contextual_links),
); );
return drupal_render($element); return \Drupal::service('renderer')->render($element);
} }
else { else {
return ''; return '';
......
...@@ -73,7 +73,7 @@ function template_preprocess_file_widget_multiple(&$variables) { ...@@ -73,7 +73,7 @@ function template_preprocess_file_widget_multiple(&$variables) {
// Render everything else together in a column, without the normal wrappers. // Render everything else together in a column, without the normal wrappers.
$widget['#theme_wrappers'] = array(); $widget['#theme_wrappers'] = array();
$information = drupal_render($widget); $information = \Drupal::service('renderer')->render($widget);
$display = ''; $display = '';
if ($element['#display_field']) { if ($element['#display_field']) {
unset($widget['display']['#title']); unset($widget['display']['#title']);
......
...@@ -64,7 +64,7 @@ public function process($text, $langcode) { ...@@ -64,7 +64,7 @@ public function process($text, $langcode) {
'#caption' => $caption, '#caption' => $caption,
'#classes' => $classes, '#classes' => $classes,
); );
$altered_html = drupal_render($filter_caption); $altered_html = \Drupal::service('renderer')->render($filter_caption);
// Load the altered HTML into a new DOMDocument and retrieve the element. // Load the altered HTML into a new DOMDocument and retrieve the element.
$updated_nodes = Html::load($altered_html)->getElementsByTagName('body') $updated_nodes = Html::load($altered_html)->getElementsByTagName('body')
......
...@@ -418,7 +418,7 @@ public function tips($long = FALSE) { ...@@ -418,7 +418,7 @@ public function tips($long = FALSE) {
'#header' => $header, '#header' => $header,
'#rows' => $rows, '#rows' => $rows,
); );
$output .= drupal_render($table); $output .= \Drupal::service('renderer')->render($table);
$output .= '<p>' . $this->t('Most unusual characters can be directly entered without any problems.') . '</p>'; $output .= '<p>' . $this->t('Most unusual characters can be directly entered without any problems.') . '</p>';
$output .= '<p>' . $this->t('If you do encounter problems, try using HTML character entities. A common example looks like &amp;amp; for an ampersand &amp; character. For a full list of entities see HTML\'s <a href=":html-entities">entities</a> page. Some of the available characters include:', array(':html-entities' => 'http://www.w3.org/TR/html4/sgml/entities.html')) . '</p>'; $output .= '<p>' . $this->t('If you do encounter problems, try using HTML character entities. A common example looks like &amp;amp; for an ampersand &amp; character. For a full list of entities see HTML\'s <a href=":html-entities">entities</a> page. Some of the available characters include:', array(':html-entities' => 'http://www.w3.org/TR/html4/sgml/entities.html')) . '</p>';
...@@ -457,7 +457,7 @@ public function tips($long = FALSE) { ...@@ -457,7 +457,7 @@ public function tips($long = FALSE) {
'#header' => $header, '#header' => $header,
'#rows' => $rows, '#rows' => $rows,
); );
$output .= drupal_render($table); $output .= \Drupal::service('renderer')->render($table);
return $output; return $output;
} }
......
...@@ -460,12 +460,12 @@ function template_preprocess_forums(&$variables) { ...@@ -460,12 +460,12 @@ function template_preprocess_forums(&$variables) {
'name' => $topic->getOwner()->getDisplayName(), 'name' => $topic->getOwner()->getDisplayName(),
'created' => $topic->getCreatedTime(), 'created' => $topic->getCreatedTime(),
)); ));
$variables['topics'][$id]->submitted = drupal_render($forum_submitted); $variables['topics'][$id]->submitted = \Drupal::service('renderer')->render($forum_submitted);
$forum_submitted = array( $forum_submitted = array(
'#theme' => 'forum_submitted', '#theme' => 'forum_submitted',
'#topic' => isset($topic->last_reply) ? $topic->last_reply : NULL, '#topic' => isset($topic->last_reply) ? $topic->last_reply : NULL,
); );
$variables['topics'][$id]->last_reply = drupal_render($forum_submitted); $variables['topics'][$id]->last_reply = \Drupal::service('renderer')->render($forum_submitted);
$variables['topics'][$id]->new_text = ''; $variables['topics'][$id]->new_text = '';
$variables['topics'][$id]->new_url = ''; $variables['topics'][$id]->new_url = '';
...@@ -569,7 +569,7 @@ function template_preprocess_forum_list(&$variables) { ...@@ -569,7 +569,7 @@ function template_preprocess_forum_list(&$variables) {
$variables['forums'][$id]->old_topics = $forum->num_topics - $variables['forums'][$id]->new_topics; $variables['forums'][$id]->old_topics = $forum->num_topics - $variables['forums'][$id]->new_topics;
} }
$forum_submitted = array('#theme' => 'forum_submitted', '#topic' => $forum->last_post); $forum_submitted = array('#theme' => 'forum_submitted', '#topic' => $forum->last_post);
$variables['forums'][$id]->last_reply = drupal_render($forum_submitted); $variables['forums'][$id]->last_reply = \Drupal::service('renderer')->render($forum_submitted);
} }
$variables['pager'] = array( $variables['pager'] = array(
...@@ -636,7 +636,7 @@ function template_preprocess_forum_submitted(&$variables) { ...@@ -636,7 +636,7 @@ function template_preprocess_forum_submitted(&$variables) {
$variables['author'] = ''; $variables['author'] = '';
if (isset($variables['topic']->uid)) { if (isset($variables['topic']->uid)) {
$username = array('#theme' => 'username', '#account' => User::load($variables['topic']->uid)); $username = array('#theme' => 'username', '#account' => User::load($variables['topic']->uid));
$variables['author'] = drupal_render($username); $variables['author'] = \Drupal::service('renderer')->render($username);
} }
$variables['time'] = isset($variables['topic']->created) ? \Drupal::service('date.formatter')->formatTimeDiffSince($variables['topic']->created) : ''; $variables['time'] = isset($variables['topic']->created) ? \Drupal::service('date.formatter')->formatTimeDiffSince($variables['topic']->created) : '';
} }
...@@ -96,7 +96,7 @@ public function render(ResultRow $values) { ...@@ -96,7 +96,7 @@ public function render(ResultRow $values) {
'#theme' => 'mark', '#theme' => 'mark',
'#status' => $mark, '#status' => $mark,
); );
return $this->renderLink(drupal_render($build), $values); return $this->renderLink(\Drupal::service('renderer')->render($build), $values);
} }
} }
......
...@@ -58,7 +58,7 @@ public function form(array $form, FormStateInterface $form_state) { ...@@ -58,7 +58,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['preview'] = array( $form['preview'] = array(
'#type' => 'item', '#type' => 'item',
'#title' => $this->t('Preview'), '#title' => $this->t('Preview'),
'#markup' => drupal_render($preview_arguments), '#markup' => \Drupal::service('renderer')->render($preview_arguments),
// Render preview above parent elements. // Render preview above parent elements.
'#weight' => -5, '#weight' => -5,
); );
......
...@@ -173,7 +173,7 @@ function _node_mass_update_batch_finished($success, $results, $operations) { ...@@ -173,7 +173,7 @@ function _node_mass_update_batch_finished($success, $results, $operations) {
'#theme' => 'item_list', '#theme' => 'item_list',
'#items' => $results, '#items' => $results,
); );
$message .= drupal_render($item_list); $message .= \Drupal::service('renderer')->render($item_list);
drupal_set_message($message); drupal_set_message($message);
} }
} }
...@@ -575,9 +575,9 @@ function template_preprocess_node(&$variables) { ...@@ -575,9 +575,9 @@ function template_preprocess_node(&$variables) {
$variables['node'] = $variables['elements']['#node']; $variables['node'] = $variables['elements']['#node'];
/** @var \Drupal\node\NodeInterface $node */ /** @var \Drupal\node\NodeInterface $node */
$node = $variables['node']; $node = $variables['node'];
$variables['date'] = drupal_render($variables['elements']['created']); $variables['date'] = \Drupal::service('renderer')->render($variables['elements']['created']);
unset($variables['elements']['created']); unset($variables['elements']['created']);
$variables['author_name'] = drupal_render($variables['elements']['uid']); $variables['author_name'] = \Drupal::service('renderer')->render($variables['elements']['uid']);
unset($variables['elements']['uid']); unset($variables['elements']['uid']);
$variables['url'] = $node->url('canonical', array( $variables['url'] = $node->url('canonical', array(
......
...@@ -110,7 +110,7 @@ public function buildRow(EntityInterface $entity) { ...@@ -110,7 +110,7 @@ public function buildRow(EntityInterface $entity) {
$row['title']['data'] = array( $row['title']['data'] = array(
'#type' => 'link', '#type' => 'link',
'#title' => $entity->label(), '#title' => $entity->label(),
'#suffix' => ' ' . drupal_render($mark), '#suffix' => ' ' . \Drupal::service('renderer')->render($mark),
'#url' => $uri, '#url' => $uri,
); );
$row['type'] = node_get_type_label($entity); $row['type'] = node_get_type_label($entity);
......
...@@ -24,7 +24,7 @@ class UnpublishByKeywordNode extends ConfigurableActionBase { ...@@ -24,7 +24,7 @@ class UnpublishByKeywordNode extends ConfigurableActionBase {
public function execute($node = NULL) { public function execute($node = NULL) {
foreach ($this->configuration['keywords'] as $keyword) { foreach ($this->configuration['keywords'] as $keyword) {
$elements = node_view(clone $node); $elements = node_view(clone $node);
if (strpos(drupal_render($elements), $keyword) !== FALSE || strpos($node->label(), $keyword) !== FALSE) { if (strpos(\Drupal::service('renderer')->render($elements), $keyword) !== FALSE || strpos($node->label(), $keyword) !== FALSE) {
$node->setPublished(FALSE); $node->setPublished(FALSE);
$node->save(); $node->save();
break; break;
......
...@@ -329,7 +329,7 @@ function rdf_preprocess_node(&$variables) { ...@@ -329,7 +329,7 @@ function rdf_preprocess_node(&$variables) {
'#theme' => 'rdf_metadata', '#theme' => 'rdf_metadata',
'#metadata' => array($date_attributes), '#metadata' => array($date_attributes),
); );
$variables['metadata'] = drupal_render($rdf_metadata); $variables['metadata'] = \Drupal::service('renderer')->render($rdf_metadata);
} }
// Adds RDFa markup annotating the number of comments a node has. // Adds RDFa markup annotating the number of comments a node has.
...@@ -534,7 +534,7 @@ function rdf_preprocess_comment(&$variables) { ...@@ -534,7 +534,7 @@ function rdf_preprocess_comment(&$variables) {
if (!empty($variables['content']['comment_body']['#prefix'])) { if (!empty($variables['content']['comment_body']['#prefix'])) {
$rdf_metadata['#suffix'] = $variables['content']['comment_body']['#prefix']; $rdf_metadata['#suffix'] = $variables['content']['comment_body']['#prefix'];
} }
$variables['content']['comment_body']['#prefix'] = drupal_render($rdf_metadata); $variables['content']['comment_body']['#prefix'] = \Drupal::service('renderer')->render($rdf_metadata);
} }
} }
......
...@@ -81,7 +81,7 @@ public function buildResults() { ...@@ -81,7 +81,7 @@ public function buildResults() {
$pager = array( $pager = array(
'#type' => 'pager', '#type' => 'pager',
); );
$output['suffix']['#markup'] = '</ol>' . drupal_render($pager); $output['suffix']['#markup'] = '</ol>' . \Drupal::service('renderer')->render($pager);
return $output; return $output;
} }
......
...@@ -437,20 +437,20 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) { ...@@ -437,20 +437,20 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
'#theme' => 'simpletest_result_summary', '#theme' => 'simpletest_result_summary',
'#label' => t($test_results[$class]['#name'] . ':'), '#label' => t($test_results[$class]['#name'] . ':'),
); );
array_unshift($items, drupal_render($class_test_result)); array_unshift($items, \Drupal::service('renderer')->render($class_test_result));
} }
$context['message'] = t('Processed test @num of @max - %test.', array('%test' => $info['name'], '@num' => $max - $size, '@max' => $max)); $context['message'] = t('Processed test @num of @max - %test.', array('%test' => $info['name'], '@num' => $max - $size, '@max' => $max));
$overall_results = $test_results + array( $overall_results = $test_results + array(
'#theme' => 'simpletest_result_summary', '#theme' => 'simpletest_result_summary',
'#label' => t('Overall results:'), '#label' => t('Overall results:'),
); );
$context['message'] .= drupal_render($overall_results); $context['message'] .= \Drupal::service('renderer')->render($overall_results);
$item_list = array( $item_list = array(
'#theme' => 'item_list', '#theme' => 'item_list',
'#items' => $items, '#items' => $items,
); );
$context['message'] .= drupal_render($item_list); $context['message'] .= \Drupal::service('renderer')->render($item_list);
// Save working values for the next iteration. // Save working values for the next iteration.
$context['sandbox']['tests'] = $test_list; $context['sandbox']['tests'] = $test_list;
......
...@@ -153,7 +153,7 @@ function template_preprocess_theme_test_render_element(&$variables) { ...@@ -153,7 +153,7 @@ function template_preprocess_theme_test_render_element(&$variables) {
* - element: An associative array containing the properties of the element. * - element: An associative array containing the properties of the element.
*/ */
function theme_theme_test_render_element_children($variables) { function theme_theme_test_render_element_children($variables) {
return drupal_render($variables['element']); return \Drupal::service('renderer')->render($variables['element']);
} }
/** /**
......
...@@ -218,7 +218,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular ...@@ -218,7 +218,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular
); );
} }
$form['terms'][$key]['term'] = array( $form['terms'][$key]['term'] = array(
'#prefix' => !empty($indentation) ? drupal_render($indentation) : '', '#prefix' => !empty($indentation) ? \Drupal::service('renderer')->render($indentation) : '',
'#type' => 'link', '#type' => 'link',
'#title' => $term->getName(), '#title' => $term->getName(),
'#url' => $term->urlInfo(), '#url' => $term->urlInfo(),
......
...@@ -69,7 +69,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ...@@ -69,7 +69,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#last' => $this->state->get('update.last_check') ?: 0, '#last' => $this->state->get('update.last_check') ?: 0,
); );
$form['last_check'] = array( $form['last_check'] = array(
'#markup' => drupal_render($last_markup), '#markup' => \Drupal::service('renderer')->render($last_markup),
); );
if (!_update_manager_check_backends($form, 'update')) { if (!_update_manager_check_backends($form, 'update')) {
......
...@@ -53,7 +53,7 @@ function update_manager_download_batch_finished($success, $results) { ...@@ -53,7 +53,7 @@ function update_manager_download_batch_finished($success, $results) {
'#title' => t('Downloading updates failed:'), '#title' => t('Downloading updates failed:'),
'#items' => $results['errors'], '#items' => $results['errors'],
); );
drupal_set_message(drupal_render($item_list), 'error'); drupal_set_message(\Drupal::service('renderer')->render($item_list), 'error');
} }
elseif ($success) { elseif ($success) {
drupal_set_message(t('Updates downloaded successfully.')); drupal_set_message(t('Updates downloaded successfully.'));
......
...@@ -77,7 +77,7 @@ public function formatMessages(array $messages) { ...@@ -77,7 +77,7 @@ public function formatMessages(array $messages) {
'#theme' => 'item_list', '#theme' => 'item_list',
'#items' => $messages, '#items' => $messages,
); );
$message = drupal_render($item_list); $message = \Drupal::service('renderer')->render($item_list);
} }
elseif ($messages) {