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_children() is being marked as deprecated so all usages of that function should be removed in Drupal core.
Proposed resolution
Replace drupal_render_children() usage with render().
Remaining tasks
Fix it!
Review!
User interface changes
-
API changes
-
Data model changes
-
Comment | File | Size | Author |
---|---|---|---|
#6 | remove-2544176-6.patch | 2.06 KB | joelpittet |
#2 | remove-2544176-2.patch | 775 bytes | lauriii |
Comments
Comment #1
lauriiiComment #2
lauriiiComment #3
lauriiiComment #4
joelpittetI tried seeing if there is another way... nothing came to mind. I don't think trading drupal_render_children() for render() call is a great win because it's an early render either way and both global function calls...
Any other ideas @lauriii?
Comment #5
lauriiiMaybe we need to figure out if we could change the render api to conditionally render children of the render element also as render elements. Otherwise we always have to run an early render in this use case.
Comment #6
joelpittetI put this patch on the meta but probably should have put it here. It's the same thing but moving it closer to the source. It also fixes some issues around checking the #wrapper_attributes before building them up which is why the drupal_render_children needs to be called to move the RenderElement's #wrapper_attributes up to the tab/task.s
Comment #7
lauriiiShould we test if tray is array? If its rendered for some reason, this will fatal..
Comment #8
joelpittetI can't think of a scenario where that would every be a rendered variable. We are early rendering things here but not that doesn't change the $element render array other than adding extra #keys in preRender by reference.
Really don't think we need to do that check. !empty() is just a consistency and performance fix. If it becomes contentious I'll remove it from this patch so we can resolve this.
Comment #9
lauriiiToolbarItem fits the previous line but otherwise this is good. Can be fixed on commit.
Comment #10
xjmDiscussed with the D8 committers and we agreed with making this an rc target.
Comment #11
webchickJust to follow-up, the reason for this is because it's the last instance of this function (which circumvents the render system and causes caching problems), and this would allow us to mark it deprecated before 8.0.0. It's not "open season" on all cleanup patches. :D
Comment #12
webchickCommitted and pushed to 8.0.x. Thanks!