For a while I thought the drupal_render_children just populated #children entries, not actually returning a concatenated string. Obviously I didn't read the documentation closely, but (thanks to Eclipse) trusted the lack of a @return tag.

I attach a small patch with the @return tag added (made against D7.24, but the issue exists also in D8).

I also include a fix for a slightly unrelated issue, where the drupal_render documentation mentions drupal_get_form as a typical caller (as in D6), while in D7 drupal_get_form returns the unrendered array structure. I put drupal_render_page as an example, but maybe there are better examples?

Comments

Status: Needs review » Needs work

The last submitted patch, common-drupal_render_children-return.patch, failed testing.

jhodgdon’s picture

Title: Doxygen @return tag for drupal_render_children » Doxygen @return tag missing for drupal_render_children
Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7, +Novice

Thanks for the issue report and and the patch! A few thoughts:

- The patch needs to be made with git diff in order to apply properly. See https://drupal.org/novice for patching instructions.
- You need to have a blank line before @return.
- We need to fix this in Drupal 8 first.
- And if you want to fix a different issue, please don't combine it with this patch, as it's unrelated. File a separate issue.

stephaneq’s picture

Status: Needs work » Needs review
StatusFileSize
new560 bytes

Based on initial patch by emok, here is a D8 patch

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

jhodgdon’s picture

Status: Reviewed & tested by the community » Needs work

Could we perhaps move the existing text that is in the function doc:

This renders all children of an element using drupal_render() and then joins them together into a single string.

into the @return (with a little editing to make it into more like "what this returns" text)? It seems silly to have that explanation of what is returned outside of the @return.

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new893 bytes

So, something like this?

longwave’s picture

StatusFileSize
new1.07 KB

While we're here we can typehint the other parameters and add an (optional).

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks -- looks good to me!

The last submitted patch, 6: 2164597-drupal_render_children-doc.patch, failed testing.

jhodgdon’s picture

That last failure message was for the patch in #6. The patch in #7 passed.

jhodgdon’s picture

There's an "avoid commit conflicts" issue that also touches common.inc and although I don't think there's a conflict, I'm being a bit cautious and will wait to commit this for a while.
#1996238: Replace hook_library_info() by *.libraries.yml file

xjm’s picture

I confirmed that this applies fine on top of or under that patch, btw.

xjm’s picture

Issue tags: +Quick fix
jhodgdon’s picture

RE #12, that may be but recently I had a patch that both webchick and I were certain wouldn't conflict, which she then committed, I got berated for triggering the need for a reroll of a big issue. So I'm being extra cautious now. It's not like this issue is too urgent.

webchick’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

At the moment there are only two viable (non-"needs work") "avoid commit conflicts" patches: #2002134: Move TypedData metadata introspection from data objects to definition objects and #1862202: Objectify the language system. I confirmed this patch doesn't conflict with either of them, so getting it in while it's hot. Since it's also confusing people in D7, I think it'd be good to get it in sooner than later.

Committed and pushed to 8.x. Thanks! Moving to 7.x for backport.

longwave’s picture

Status: Patch (to be ported) » Needs review
Issue tags: -Needs backport to D7
StatusFileSize
new1.02 KB
jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine, thanks! I will get it committed sometime soon, unless another committer gets to it before me.

jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all! Committed to 7.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.