Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
- Avoid rendering manually by letting the template who is printing the variable render it.
- Inject the renderer service into service, which uses drupal_render()
- Use \Drupal::service('renderer')->render() for old prodecural code.
Remaining tasks
- Find all the actionable fixes: Search for
drupal_render(
- Create a Patch
- Review
User interface changes
None
API changes
None
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. |
Comment | File | Size | Author |
---|---|---|---|
#2 | 2471913_1.patch | 8.83 KB | Mile23 |
Comments
Comment #1
Mile23Comment #2
Mile23First-pass. Passes most of the simpletest tests... Let's see how it fares with the testbot.
Comment #3
Mile23Comment #4
willzyx CreditAttribution: willzyx commentedleading slash is missing. Should be
@var \Drupal\Core\Render\Renderer
Comment #5
cilefen CreditAttribution: cilefen commentedThis is a duplicate as per #2393329-41: Replace all drupal_render calls with the service, and inject it, if possible.