Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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
Comment | File | Size | Author |
---|---|---|---|
#10 | replace_all-2471857-10.patch | 10.39 KB | keopx |
#10 | interdiff-replace_all-2471857-7-10.txt | 584 bytes | keopx |
#7 | replace_all-2471857-7.patch | 10.4 KB | mitrpaka |
#4 | book-replace_all_drupal_render-2471857-4.patch | 2.02 KB | focus13 |
Comments
Comment #1
Noe_ CreditAttribution: Noe_ at Devhouse Spindle commentedComment #2
Noe_ CreditAttribution: Noe_ at Devhouse Spindle commentedComment #3
focus13 CreditAttribution: focus13 commentedComment #4
focus13 CreditAttribution: focus13 commentedThis patch can fix this issue.
Comment #5
focus13 CreditAttribution: focus13 commentedComment #7
mitrpaka CreditAttribution: mitrpaka commentedComment #8
Mile23"A structured renderable array." might be better.
Comment #9
keopxComment #10
keopxComment #11
dimaro CreditAttribution: dimaro at La Drupalera by Emergya commented@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?
Comment #12
cilefen CreditAttribution: cilefen commentedThis is a duplicate as per #2393329-41: Replace all drupal_render calls with the service, and inject it, if possible.