function webform_share_node_insert in Webform share 7
Implements hook_node_insert().
File
- ./
webform_share.module, line 300 - Module to handle importing and exporting of webforms, as well as adding the ability to set content type defaults.
Code
function webform_share_node_insert($node) {
if ($type_defaults = webform_share_node_type_defaults($node->type)) {
if ($webform = _webform_share_eval($type_defaults)) {
$hook_params = array(
'operation' => 'insert',
'node' => $node,
'options' => array(
'components_only' => FALSE,
'keep_existing_components' => FALSE,
),
);
drupal_alter('webform_share_import', $webform, $hook_params);
$node->webform = $webform;
$node->webform['nid'] = $node->nid;
if (isset($node->webform['components'])) {
$node->webform['components'] = array_filter((array) $node->webform['components']);
foreach ($node->webform['components'] as $index => $component) {
$node->webform['components'][$index]['nid'] = $node->nid;
}
}
if (isset($node->webform['emails'])) {
foreach ($node->webform['emails'] as $index => $email) {
$node->webform['emails'][$index]['nid'] = $node->nid;
}
}
}
}
}