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 replace_all-2471857-10.patch10.39 KBkeopx
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,396 pass(es). View
#10 interdiff-replace_all-2471857-7-10.txt584 byteskeopx
#7 replace_all-2471857-7.patch10.4 KBmitrpaka
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,534 pass(es). View
#4 book-replace_all_drupal_render-2471857-4.patch2.02 KBfocus13
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 82,791 pass(es), 6 fail(s), and 1 exception(s). View

Comments

Noe_’s picture

Title: [META] Replace all drupal_render calls in core/modules/book » Replace all drupal_render calls in core/modules/book
Noe_’s picture

Issue summary: View changes
focus13’s picture

Assigned: Unassigned » focus13
focus13’s picture

Status: Active » Needs review
FileSize
2.02 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 82,791 pass(es), 6 fail(s), and 1 exception(s). View

This patch can fix this issue.

focus13’s picture

Assigned: focus13 » Unassigned

Status: Needs review » Needs work

The last submitted patch, 4: book-replace_all_drupal_render-2471857-4.patch, failed testing.

mitrpaka’s picture

Status: Needs work » Needs review
FileSize
10.4 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,534 pass(es). View
Mile23’s picture

Status: Needs review » Needs work
+++ b/core/modules/book/src/BookManagerInterface.php
@@ -253,7 +253,7 @@ public function deleteFromBook($nid);
-   *   A structured array to be rendered by drupal_render().
+   *   A structured array to be rendered by renderer.

"A structured renderable array." might be better.

keopx’s picture

Assigned: Unassigned » keopx
keopx’s picture

Assigned: keopx » Unassigned
Status: Needs work » Needs review
FileSize
584 bytes
10.39 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,396 pass(es). View
dimaro’s picture

@Mile23 I see that in the same method syntax used different arrays.
We should create a separate issue or make the necessary changes here so that one method has the same syntax array?

cilefen’s picture

Status: Needs review » Closed (duplicate)