You are here

function webform_share_nodeapi in Webform share 6

Implements hook_nodeapi(). Sets the default components on a webbform node.

File

./webform_share.module, line 185
Module to handle importing and exporting of webforms, as well as adding the ability to set content type defaults.

Code

function webform_share_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'insert':
      if ($type_defaults = webform_share_node_type_defaults($node->type)) {
        if ($webform = _webform_share_eval($type_defaults)) {

          // Maybe issues with doing an update during a insert?
          $updated_node = node_load($node->nid, NULL, TRUE);
          webform_share_update_node($updated_node, $webform, 0);
          drupal_set_message('Default webform components have been created');
        }
      }
      break;
  }
}