Parent issue #2393329: Replace all drupal_render calls with the service, and inject it, if possible.

Problem/Motivation

drupal_render() was marked as deprecated, though its still called in quite some places.

Proposed resolution

  1. Avoid rendering manually by letting the template who is printing the variable render it.
  2. Inject the renderer service into service, which uses drupal_render()
  3. Use \Drupal::service('renderer')->render() for old prodecural code.

Remaining tasks

  1. Find all the actionable fixes: Search for drupal_render(
  2. Create a Patch
  3. Review

User interface changes

None

API changes

None

Files: 
CommentFileSizeAuthor
#10 interdiff-aggregator_replace_drupal_render-2473161-7-10.txt445 byteskeopx
#10 aggregator_replace_drupal_render-2473161-10.patch4.93 KBkeopx
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,412 pass(es). View
#7 interdiff-aggregator_replace_drupal_render-2473161-4-7.txt1.24 KBkeopx
#7 aggregator_replace_drupal_render-2473161-7.patch4.92 KBkeopx
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,426 pass(es), 3 fail(s), and 0 exception(s). View
#4 aggregator_replace_drupal_render-2473161-4.patch3.42 KBkeopx
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,393 pass(es). View
#4 interduff-aggregator_replace_drupal_render-2473161-1-4.txt1.73 KBkeopx
#1 aggregator_replace_drupal_render-2473161-1.patch3.38 KBkeopx
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,767 pass(es). View

Comments

keopx’s picture

Assigned: keopx » Unassigned
Status: Active » Needs review
FileSize
3.38 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,767 pass(es). View
cilefen’s picture

Status: Needs review » Needs work
keopx’s picture

Assigned: Unassigned » keopx
keopx’s picture

Assigned: keopx » Unassigned
Status: Needs work » Needs review
FileSize
1.73 KB
3.42 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,393 pass(es). View
Mile23’s picture

Status: Needs review » Needs work

There are a couple of references to drupal_render() in doc blocks in AggregatorController.php.

There's also a use of drupal_render_root() in Rss.php, but that might be out of scope of this issue.

keopx’s picture

Assigned: Unassigned » keopx
keopx’s picture

Assigned: keopx » Unassigned
Status: Needs work » Needs review
FileSize
4.92 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,426 pass(es), 3 fail(s), and 0 exception(s). View
1.24 KB

Status: Needs review » Needs work

The last submitted patch, 7: aggregator_replace_drupal_render-2473161-7.patch, failed testing.

keopx’s picture

Assigned: Unassigned » keopx
keopx’s picture

Assigned: keopx » Unassigned
Status: Needs work » Needs review
FileSize
4.93 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,412 pass(es). View
445 bytes
cilefen’s picture

Status: Needs review » Needs work
+++ b/core/modules/aggregator/src/Plugin/views/row/Rss.php
@@ -79,7 +79,7 @@ public function render($row) {
-    return drupal_render_root($build);
+    return  \Drupal::service('renderer')->renderRoot($build);

You could inject the render into RssPluginBase.

cilefen’s picture

Status: Needs work » Closed (duplicate)