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

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because this removes usages of a deprecated function.
Issue priority Not critical because the function in question is not to be removed in this release cycle.
Files: 
CommentFileSizeAuthor
#2 2471913_1.patch8.83 KBMile23
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,475 pass(es). View

Comments

Mile23’s picture

Issue summary: View changes
Mile23’s picture

Assigned: Mile23 » Unassigned
Status: Active » Needs review
FileSize
8.83 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,475 pass(es). View

First-pass. Passes most of the simpletest tests... Let's see how it fares with the testbot.

Mile23’s picture

Issue tags: -Needs beta evaluation
willzyx’s picture

+++ b/core/modules/simpletest/src/Form/SimpletestTestForm.php
@@ -18,6 +20,30 @@
+   * Rendering service.
+   *
+   * @var Drupal\Core\Render\Renderer
+   */
+  protected $renderer;

leading slash is missing. Should be @var \Drupal\Core\Render\Renderer

cilefen’s picture

Status: Needs review » Closed (duplicate)