Hi,
Really simple, but allow a bit of flexibility of rendering submission:
--- webform.submissions.inc.old 2010-05-25 10:38:04.000000000 -0500
+++ webform.submissions.inc 2010-05-25 10:43:29.000000000 -0500
@@ -230,7 +230,7 @@
_webform_client_form_add_component($component, NULL, $renderable, $renderable, $submission, $format);
}
}
-
+ $renderable = drupal_alter('webform_submission_render', $renderable);
return drupal_render($renderable);
}
with this patch we can use:
function MODULE_NAME_webform_submission_render_alter(&$renderable) {
// ...
}
to easily alter data represented on submission report page.
also, patch with the same content attached for convenience.
Comments
Comment #1
pavel.karoukin commentedoh. my bad. used this drupal_alter() in a wrong way. correct way to use:
fixed patch attached =)
Comment #2
pavel.karoukin commentedanother revision - putting all variable used in render function =) (found this useful)
Comment #3
quicksketchThanks, I think this is a good improvement, since the Webform renderable is essentially identical to the way forms are built, but we currently have no way of modifying the way Webform submissions are displayed.
The only caveat I see in this patch is that Drupal 7 only supports 3 parameters, but our patch here has 4. See http://api.lullabot.com/drupal_alter/7.
So to fix this problem the suggested approach is to introduce a $context variable and put everything in that variable. So our function would actually look like:
Comment #4
quicksketchAfter some thought, I decided it would actually be most beneficial to simply combine the extra parameters into properties within the renderable (such as #node, #submission, and #email). This makes our renderable consistent with the addition of #node and #submission to the $form array in #821030: Bind $node and $submission to $form in webform_client_form.
I've committed this patch, thanks for your suggestions and please let me know if further changes seem like they would be necessary.
Comment #5
pavel.karoukin commentedVery nice! Thanks!