Commit e223ebe5 authored by xjm's avatar xjm

Revert "Issue #2704871 by pepegarciag, ieguskiza, snehi, gaurav.pahuja,...

Revert "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()"

This reverts commit ae3ee317.
parent ae3ee317
......@@ -896,7 +896,7 @@ function drupal_render_children(&$element, $children_keys = NULL) {
$output = '';
foreach ($children_keys as $key) {
if (!empty($element[$key])) {
$output .= \Drupal::service('bare_html_page_renderer')->render($element[$key]);
$output .= drupal_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::service('renderer')->render($tablesort_indicator);
$image = drupal_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::service('renderer')->render($list);
$message .= drupal_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::service('renderer')->render($menu);
* $menu_html = drupal_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::service('renderer')->render($element[$key]);
$row['data'][] = drupal_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::service('renderer')->render($preprocess_bubbleable);
drupal_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::service('renderer')->render($title);
$replacements[$context['tokens']['title']] = drupal_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::service('renderer')->render($select_all),
'<!--action-bulk-form-select-all-->' => drupal_render($select_all),
);
}
......@@ -437,7 +437,7 @@ function template_preprocess_book_navigation(&$variables) {
}
if (!empty($build)) {
\Drupal::service('renderer')->render($build);
drupal_render($build);
}
$variables['has_links'] = FALSE;
......
......@@ -220,7 +220,7 @@ protected function bookAdminTableTree(array $tree, array &$form) {
}
$form[$id]['title'] = [
'#prefix' => !empty($indentation) ? \Drupal::service('renderer')->render($indentation) : '',
'#prefix' => !empty($indentation) ? drupal_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::service('renderer')->render($username);
$variables['author'] = drupal_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::service('renderer')->render($username);
$variables['parent_author'] = drupal_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::service('renderer')->render($this->build[$entity->id()]['links']['comment__comment']) : '';
return !empty($this->build[$entity->id()]['links']['comment__comment']) ? drupal_render($this->build[$entity->id()]['links']['comment__comment']) : '';
}
}
......@@ -70,7 +70,7 @@ public function render(ResultRow $values) {
'#theme' => 'username',
'#account' => $account,
);
return \Drupal::service('renderer')->render($username);
return drupal_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::service('renderer')->render($field_element),
'data' => drupal_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::service('renderer')->render($column_element[$key]),
'data' => drupal_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::service('renderer')->render($element);
return drupal_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::service('renderer')->render($widget);
$information = drupal_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::service('renderer')->render($filter_caption);
$altered_html = drupal_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::service('renderer')->render($table);
$output .= drupal_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::service('renderer')->render($table);
$output .= drupal_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::service('renderer')->render($forum_submitted);
$variables['topics'][$id]->submitted = drupal_render($forum_submitted);
$forum_submitted = array(
'#theme' => 'forum_submitted',
'#topic' => isset($topic->last_reply) ? $topic->last_reply : NULL,
);
$variables['topics'][$id]->last_reply = \Drupal::service('renderer')->render($forum_submitted);
$variables['topics'][$id]->last_reply = drupal_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::service('renderer')->render($forum_submitted);
$variables['forums'][$id]->last_reply = drupal_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::service('renderer')->render($username);
$variables['author'] = drupal_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::service('renderer')->render($build), $values);
return $this->renderLink(drupal_render($build), $values);
}
}
......
......@@ -58,7 +58,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['preview'] = array(
'#type' => 'item',
'#title' => $this->t('Preview'),
'#markup' => \Drupal::service('renderer')->render($preview_arguments),
'#markup' => drupal_render($preview_arguments),
// Render preview above parent elements.
'#weight' => -5,
);
......
......@@ -173,7 +173,7 @@ function _node_mass_update_batch_finished($success, $results, $operations) {
'#theme' => 'item_list',
'#items' => $results,
);
$message .= \Drupal::service('renderer')->render($item_list);
$message .= drupal_render($item_list);
drupal_set_message($message);
}
}
......@@ -575,9 +575,9 @@ function template_preprocess_node(&$variables) {
$variables['node'] = $variables['elements']['#node'];
/** @var \Drupal\node\NodeInterface $node */
$node = $variables['node'];
$variables['date'] = \Drupal::service('renderer')->render($variables['elements']['created']);
$variables['date'] = drupal_render($variables['elements']['created']);
unset($variables['elements']['created']);
$variables['author_name'] = \Drupal::service('renderer')->render($variables['elements']['uid']);
$variables['author_name'] = drupal_render($variables['elements']['uid']);
unset($variables['elements']['uid']);
$variables['url'] = $node->url('canonical', array(
......
......@@ -110,7 +110,7 @@ public function buildRow(EntityInterface $entity) {
$row['title']['data'] = array(
'#type' => 'link',
'#title' => $entity->label(),
'#suffix' => ' ' . \Drupal::service('renderer')->render($mark),
'#suffix' => ' ' . drupal_render($mark),
'#url' => $uri,
);
$row['type'] = node_get_type_label($entity);
......
......@@ -24,7 +24,7 @@ class UnpublishByKeywordNode extends ConfigurableActionBase {
public function execute($node = NULL) {
foreach ($this->configuration['keywords'] as $keyword) {
$elements = node_view(clone $node);
if (strpos(\Drupal::service('renderer')->render($elements), $keyword) !== FALSE || strpos($node->label(), $keyword) !== FALSE) {
if (strpos(drupal_render($elements), $keyword) !== FALSE || strpos($node->label(), $keyword) !== FALSE) {
$node->setPublished(FALSE);
$node->save();
break;
......
......@@ -329,7 +329,7 @@ function rdf_preprocess_node(&$variables) {
'#theme' => 'rdf_metadata',
'#metadata' => array($date_attributes),
);
$variables['metadata'] = \Drupal::service('renderer')->render($rdf_metadata);
$variables['metadata'] = drupal_render($rdf_metadata);
}
// Adds RDFa markup annotating the number of comments a node has.
......@@ -534,7 +534,7 @@ function rdf_preprocess_comment(&$variables) {
if (!empty($variables['content']['comment_body']['#prefix'])) {
$rdf_metadata['#suffix'] = $variables['content']['comment_body']['#prefix'];
}
$variables['content']['comment_body']['#prefix'] = \Drupal::service('renderer')->render($rdf_metadata);
$variables['content']['comment_body']['#prefix'] = drupal_render($rdf_metadata);
}
}
......
......@@ -81,7 +81,7 @@ public function buildResults() {
$pager = array(
'#type' => 'pager',
);
$output['suffix']['#markup'] = '</ol>' . \Drupal::service('renderer')->render($pager);
$output['suffix']['#markup'] = '</ol>' . drupal_render($pager);
return $output;
}
......
......@@ -437,20 +437,20 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
'#theme' => 'simpletest_result_summary',
'#label' => t($test_results[$class]['#name'] . ':'),
);
array_unshift($items, \Drupal::service('renderer')->render($class_test_result));
array_unshift($items, drupal_render($class_test_result));
}
$context['message'] = t('Processed test @num of @max - %test.', array('%test' => $info['name'], '@num' => $max - $size, '@max' => $max));
$overall_results = $test_results + array(
'#theme' => 'simpletest_result_summary',
'#label' => t('Overall results:'),
);
$context['message'] .= \Drupal::service('renderer')->render($overall_results);
$context['message'] .= drupal_render($overall_results);
$item_list = array(
'#theme' => 'item_list',
'#items' => $items,
);
$context['message'] .= \Drupal::service('renderer')->render($item_list);
$context['message'] .= drupal_render($item_list);
// Save working values for the next iteration.
$context['sandbox']['tests'] = $test_list;
......
......@@ -153,7 +153,7 @@ function template_preprocess_theme_test_render_element(&$variables) {
* - element: An associative array containing the properties of the element.
*/
function theme_theme_test_render_element_children($variables) {
return \Drupal::service('renderer')->render($variables['element']);
return drupal_render($variables['element']);
}
/**
......
......@@ -218,7 +218,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular
);
}
$form['terms'][$key]['term'] = array(
'#prefix' => !empty($indentation) ? \Drupal::service('renderer')->render($indentation) : '',
'#prefix' => !empty($indentation) ? drupal_render($indentation) : '',
'#type' => 'link',
'#title' => $term->getName(),
'#url' => $term->urlInfo(),
......
......@@ -69,7 +69,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#last' => $this->state->get('update.last_check') ?: 0,
);
$form['last_check'] = array(
'#markup' => \Drupal::service('renderer')->render($last_markup),
'#markup' => drupal_render($last_markup),
);
if (!_update_manager_check_backends($form, 'update')) {
......
......@@ -53,7 +53,7 @@ function update_manager_download_batch_finished($success, $results) {
'#title' => t('Downloading updates failed:'),
'#items' => $results['errors'],
);
drupal_set_message(\Drupal::service('renderer')->render($item_list), 'error');
drupal_set_message(drupal_render($item_list), 'error');
}
elseif ($success) {
drupal_set_message(t('Updates downloaded successfully.'));
......
......@@ -77,7 +77,7 @@ public function formatMessages(array $messages) {
'#theme' => 'item_list',
'#items' => $messages,
);
$message = \Drupal::service('renderer')->render($item_list);
$message = drupal_render($item_list);
}
elseif ($messages) {
$message = array_shift($messages);
......
......@@ -47,7 +47,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'@page_count -- the total page count',
),
);
$list = \Drupal::service('renderer')->render($item_list);
$list = drupal_render($item_list);
$form['content'] = array(
'#title' => $this->t('Display'),
'#type' => 'textarea',
......
......@@ -90,7 +90,7 @@ public function renderItems($items) {
'#list_type' => $this->options['type'],
);
}
return \Drupal::service('renderer')->render($render);
return drupal_render($render);
}
}
......
......@@ -614,7 +614,7 @@ function views_pre_render_views_form_views_form($element) {
$row_id = $substitution['row_id'];
$search[] = $substitution['placeholder'];
$replace[] = isset($element[$field_name][$row_id]) ? \Drupal::service('renderer')->render($element[$field_name][$row_id]) : '';
$replace[] = isset($element[$field_name][$row_id]) ? drupal_render($element[$field_name][$row_id]) : '';
}
// Add in substitutions from hook_views_form_substitutions().
$substitutions = \Drupal::moduleHandler()->invokeAll('views_form_substitutions');
......@@ -628,7 +628,7 @@ function views_pre_render_views_form_views_form($element) {
}
// Apply substitutions to the rendered output.
$output = str_replace($search, $replace, \Drupal::service('renderer')->render($element['output']));
$output = str_replace($search, $replace, drupal_render($element['output']));
$element['output'] = ['#markup' => ViewsRenderPipelineMarkup::create($output)];
return $element;
......
......@@ -74,7 +74,7 @@ public function getDescription() {
'#theme' => 'username',
'#account' => $account,
);
return $this->t('By breaking this lock, any unsaved changes made by @user will be lost.', array('@user' => \Drupal::service('renderer')->render($username)));
return $this->t('By breaking this lock, any unsaved changes made by @user will be lost.', array('@user' => drupal_render($username)));
}
/**
......
......@@ -130,7 +130,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#account' => $this->entityManager->getStorage('user')->load($view->lock->owner),
);
$lock_message_substitutions = array(
'@user' => \Drupal::service('renderer')->render($username),
'@user' => drupal_render($username),
'@age' => $this->dateFormatter->formatTimeDiffSince($view->lock->updated),
':url' => $view->url('break-lock-form'),
);
......
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