Hello,
I have a set of webforms that I use for several purposes on my site. I have used the webform because I value the nice workflow features. The downside has been the data is kind of stuck in there. I could probably duplicate the webform capabilities for validation and additional processing I use, but it seems like a tough road. My thought is that at the end of the additional processing, I stick some additional code to add a node to my cck content type. Then I get the best of both worlds. I get the nice webform structured input form and I can use views to unlock the value of the data.
My question is could I use a statement like this one that I found example here: http://api.drupal.org/api/function/hook_nodeapi/6 ? I am thinking that I would need to set variables for each field in the new node that is to be created with the presave, and use the insert to add the node. I am unsure how to tell it what content type to use. Any pointers would be greatly appreciated. Perhaps I am making this more complicated and I need to make the switch to cck... Thanks
function hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'presave':
if ($node->nid && $node->moderate) {
// Reset votes when node is updated:
$node->score = 0;
$node->users = '';
$node->votes = 0;
}
break;
case 'insert':
case 'update':
if ($node->moderate && user_access('access submission queue')) {
drupal_set_message(t('The post is queued for approval'));
}
elseif ($node->moderate) {
drupal_set_message(t('The post is queued for approval. The editors will decide whether it should be published.'));
}
break;
case 'view':
$node->content['my_additional_field'] = array(
'#value' => theme('mymodule_my_additional_field', $additional_field),
'#weight' => 10,
);
break;
}
}
Comments
Comment #1
maddentim commentedswitching this from documentation to miscellaneous as it seems like it is beyond documentation.
Comment #2
quicksketchSupport for custom coding is no longer provided in the Webform issue queue.