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.
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
Comment | File | Size | Author |
---|---|---|---|
#2 | replace_all-2473743-2.patch | 3.81 KB | dimaro |
#2 | interdiff-2473743-1-2.txt | 780 bytes | dimaro |
#1 | replace_all-2473743-1.patch | 3.28 KB | willzyx |
Comments
Comment #1
willzyx CreditAttribution: willzyx commentedComment #2
dimaro CreditAttribution: dimaro at La Drupalera by Emergya commentedRemove "use Drupal\Component\Uuid\UuidInterface" and "use Drupal\Core\Entity\EntityManagerInterface" because it is not used.
Also I remove whitespace.
Comment #3
webchickThanks @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..