I am looking to have a webform posted to specific destination depending on submitted values.
I thought this could be done through the webform api, webform.api.php line 209 has this hook defined:
/**
* Alter the display of a Webform submission.
*
* This function applies to both e-mails sent by Webform and normal display of
* submissions when viewing through the adminsitrative interface.
*
* @param $renderable
* The Webform submission in a renderable array, similar to FormAPI's
* structure. This variable must be passed in by-reference. Important
* properties of this array include #node, #submission, #email, and #format,
* which can be used to find the context of the submission that is being
* rendered.
*/
function hook_webform_submission_render_alter(&$renderable) {
// Remove page breaks from sent e-mails.
if (isset($renderable['#email'])) {
foreach (element_children($renderable) as $key) {
if ($renderable[$key]['#component']['type'] == 'pagebreak') {
unset($renderable[$key]);
}
}
}
}
So I set out to use it with the following ina custom module:
// Implements hook_webform_submission_render_alter
function formHelper_webform_submission_render_alter(&$renderable) {
// Just a dump to confirm hook was invoked...
kpr($renderable);
dpm($renderable);
}
However, it seems the hook is not being called. Am I missing something in here to use webform api? Is this even a regular hook? it seems I could get away with just calling the api's function but I would like to be sure of the Drupal way to go.