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


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


API changes


Beta phase evaluation

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.
#1 2473393_1.patch3.2 KBMile23
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,398 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Mile23’s picture

Status: Active » Needs review
3.2 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,398 pass(es). View

This patch only represents code changes, not docblock changes.

heddn’s picture

Can we make the docblock changes as well? There isn't a separate issue to do that as it was expected this would pick up both pieces.

Mile23’s picture

It's not done yet. :-)

webchick’s picture

Status: Needs review » Closed (duplicate)

Thanks @willzyx for all your work on these! Unfortunately, these issues need to be postponed to 8.1.x at least. See the allowed beta changes policy and the comment in #2393329-39: Replace all drupal_render calls with the service, and inject it, if possible..