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
render()
calls drupal_render()
which calls \Drupal::service('renderer')->render()
. That's three layers. drupal_render()
is deprecated. It won't make a world of difference, but it does reduce the number of unnecessary steps.
Proposed resolution
Let render()
not call drupal_render()
, but call the Renderer service directly.
Remaining tasks
Do it.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#11 | interdiff-11.txt | 274 bytes | joshi.rohit100 |
#11 | render_should_call-2471216-11.patch | 1.25 KB | joshi.rohit100 |
#5 | render_should_call-2471216-5.patch | 1.2 KB | PieterJanPut |
#2 | 2471216-renderer-service-place-of-drupal_render-2.patch | 1.2 KB | joshi.rohit100 |
Comments
Comment #1
Wim LeersComment #2
joshi.rohit100Done.
Comment #4
Wim LeersIt used to be
$element
, now it is$elements
.:)
Comment #5
PieterJanPut CreditAttribution: PieterJanPut at iO commentedComment #6
joshi.rohit100Thats what happen when you copy paste ):
Comment #7
PieterJanPut CreditAttribution: PieterJanPut at iO commentedComment #8
dawehnerDoes it make sense to still point to the renderer?
Comment #9
googletorp CreditAttribution: googletorp commentedThis looks good.
#8 There's not any reason for reffering a deprecated function, so the @see reference should be deleted as in the patch.
Comment #10
Wim Leers#9: @dawehner means you should add an
@see \Drupal\Core\Render\RendererInterface
.Comment #11
joshi.rohit100Done.
Comment #12
amateescu CreditAttribution: amateescu for Drupal Association commentedLooks good to me.
Comment #13
googletorp CreditAttribution: googletorp at Reveal IT commentedAlso looks good to me.
RTBC imo.
Comment #14
fgmAny reason why we don't inline the one-line show() too ?
Comment #15
Wim Leers#14: we could, but that is less justified, since
drupal_render()
is deprecated, andshow()
isn't.Comment #16
webchickSeems like a straight-forward fix.
Committed and pushed to 8.0.x. Thanks!