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

Support from Acquia helps fund testing for Drupal Acquia logo

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

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
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
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)