Drupal webform中的数组到字符串转换

Before upgrading from Webfrom 7.3 to 7.4, this code used to work

 $html = $html . webform_submission_render($node, $submission, NULL, 'html');

My HTML would display and then the HTML from the submission would follow.

Now, it returns a page displaying the contents of $html and then prints Array after. Drupal gives me a "Notice: Array to string conversion". This is the HTML from that section on the page:

...16:16:22(/p)(/div)(br/)(br/)Array (/div)

If I exclude the function and just leave the $html:

$html = $html

all the HTML is displayed correctly.

If I exclude the $html and just leave the function:

$html = webform_submission_render($node, $submission, NULL, 'html');

the submission is displayed correctly on the page, in HTML. I then used dpm:

dpm(webform_submission_render($node, $submission, NULL, 'html') );

and it, in fact, returns ...(Array, 15 elements)

How do I get the array to actually convert to html before appending to the rest of the $html?

This is most likely a bug in Webform 7.4. The webform_submission_render() function was changed in 7.4, and doesn't pass $renderable through drupal_render() before returning. Inserting drupal_render() into the function as before returns the correct HTML. Alternatively, assigning the webform_submission_render() to a variable and then passing it through drupal_render() in the custom code produces the same result.

$record = webform_submission_render($node, $submission, NULL, 'html');
$html = $html . drupal_render($record);