Commit ae3ee317 authored by xjm's avatar xjm
Browse files

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) {
$output = '';
foreach ($children_keys as $key) {
if (!empty($element[$key])) {
$output .= drupal_render($element[$key]);
$output .= \Drupal::service('bare_html_page_renderer')->render($element[$key]);
}
}
return Markup::create($output);
......
......@@ -53,7 +53,7 @@ function tablesort_header(&$cell_content, array &$cell_attributes, array $header
'#theme' => 'tablesort_indicator',
'#style' => $ts['sort'],
);
$image = drupal_render($tablesort_indicator);
$image = \Drupal::service('renderer')->render($tablesort_indicator);
}
else {
// If the user clicks a different header, we want to sort ascending initially.
......
......@@ -120,7 +120,7 @@ function callback_batch_finished($success, $results, $operations) {
'#theme' => 'item_list',
'#items' => $results,
);
$message .= drupal_render($list);
$message .= \Drupal::service('renderer')->render($list);
drupal_set_message($message);
}
else {
......
......@@ -201,7 +201,7 @@
* // Finally, build a renderable array from the transformed tree.
* $menu = $menu_tree->build($tree);
*
* $menu_html = drupal_render($menu);
* $menu_html = \Drupal::service('renderer')->render($menu);
* @endcode
*
* @}
......
......@@ -159,7 +159,7 @@ public static function preRenderTableselect($element) {
$row += $element['#options'][$key]['#attributes'];
}
// 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
// the correct order by iterating over the header fields.
......
......@@ -303,7 +303,7 @@ public function render($hook, array $variables) {
unset($preprocess_bubbleable['#cache']['keys']);
if ($preprocess_bubbleable) {
// @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
// of a field (field_title).
if (isset($context['tokens']['title'])) {
$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() {
'#attributes' => array('class' => array('action-table-select-all')),
);
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) {
}
if (!empty($build)) {
drupal_render($build);
\Drupal::service('renderer')->render($build);
}
$variables['has_links'] = FALSE;
......
......@@ -220,7 +220,7 @@ protected function bookAdminTableTree(array $tree, array &$form) {
}
$form[$id]['title'] = [
'#prefix' => !empty($indentation) ? drupal_render($indentation) : '',
'#prefix' => !empty($indentation) ? \Drupal::service('renderer')->render($indentation) : '',
'#type' => 'textfield',
'#default_value' => $data['link']['title'],
'#maxlength' => 255,
......
......@@ -631,7 +631,7 @@ function template_preprocess_comment(&$variables) {
'#theme' => 'username',
'#account' => $account,
);
$variables['author'] = drupal_render($username);
$variables['author'] = \Drupal::service('renderer')->render($username);
$variables['author_id'] = $comment->getOwnerId();
$variables['new_indicator_timestamp'] = $comment->getChangedTime();
$variables['created'] = format_date($comment->getCreatedTime());
......@@ -677,7 +677,7 @@ function template_preprocess_comment(&$variables) {
'#theme' => 'username',
'#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());
// Avoid calling format_date() twice on the same timestamp.
if ($comment_parent->getChangedTime() == $comment_parent->getCreatedTime()) {
......
......@@ -72,7 +72,7 @@ public function render(ResultRow $values) {
$entity = $this->getEntity($values);
// 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) {
'#theme' => 'username',
'#account' => $account,
);
return drupal_render($username);
return \Drupal::service('renderer')->render($username);
}
else {
return $this->sanitizeValue($this->getValue($values));
......
......@@ -209,7 +209,7 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
$rows[] = array(
'data' => array(
array(
'data' => drupal_render($field_element),
'data' => \Drupal::service('renderer')->render($field_element),
'class' => array('translatable'),
),
array(
......@@ -243,7 +243,7 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
$rows[] = array(
'data' => array(
array(
'data' => drupal_render($column_element[$key]),
'data' => \Drupal::service('renderer')->render($column_element[$key]),
'class' => array('translatable'),
),
array(
......
......@@ -138,7 +138,7 @@ public function render(ResultRow $values) {
'#type' => 'contextual_links_placeholder',
'#id' => _contextual_links_to_id($contextual_links),
);
return drupal_render($element);
return \Drupal::service('renderer')->render($element);
}
else {
return '';
......
......@@ -73,7 +73,7 @@ function template_preprocess_file_widget_multiple(&$variables) {
// Render everything else together in a column, without the normal wrappers.
$widget['#theme_wrappers'] = array();
$information = drupal_render($widget);
$information = \Drupal::service('renderer')->render($widget);
$display = '';
if ($element['#display_field']) {
unset($widget['display']['#title']);
......
......@@ -64,7 +64,7 @@ public function process($text, $langcode) {
'#caption' => $caption,
'#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.
$updated_nodes = Html::load($altered_html)->getElementsByTagName('body')
......
......@@ -418,7 +418,7 @@ public function tips($long = FALSE) {
'#header' => $header,
'#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('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) {
'#header' => $header,
'#rows' => $rows,
);
$output .= drupal_render($table);
$output .= \Drupal::service('renderer')->render($table);
return $output;
}
......
......@@ -460,12 +460,12 @@ function template_preprocess_forums(&$variables) {
'name' => $topic->getOwner()->getDisplayName(),
'created' => $topic->getCreatedTime(),
));
$variables['topics'][$id]->submitted = drupal_render($forum_submitted);
$variables['topics'][$id]->submitted = \Drupal::service('renderer')->render($forum_submitted);
$forum_submitted = array(
'#theme' => 'forum_submitted',
'#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_url = '';
......@@ -569,7 +569,7 @@ function template_preprocess_forum_list(&$variables) {
$variables['forums'][$id]->old_topics = $forum->num_topics - $variables['forums'][$id]->new_topics;
}
$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(
......@@ -636,7 +636,7 @@ function template_preprocess_forum_submitted(&$variables) {
$variables['author'] = '';
if (isset($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) : '';
}
......@@ -96,7 +96,7 @@ public function render(ResultRow $values) {
'#theme' => 'mark',
'#status' => $mark,
);
return $this->renderLink(drupal_render($build), $values);
return $this->renderLink(\Drupal::service('renderer')->render($build), $values);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment