function webform_component_clone in Webform 6.2
Same name and namespace in other branches
- 5.2 webform_components.inc \webform_component_clone()
- 6.3 includes/webform.components.inc \webform_component_clone()
- 7.4 includes/webform.components.inc \webform_component_clone()
- 7.3 includes/webform.components.inc \webform_component_clone()
Recursively insert components into the database.
Parameters
$node: The node object containing the current webform.
$component: A full component containing fields from the component form.
1 call to webform_component_clone()
File
- ./
webform_components.inc, line 567 - Webform module components handling.
Code
function webform_component_clone(&$node, &$component) {
$original_cid = $component['cid'];
unset($component['cid']);
$new_cid = webform_component_insert($component);
if ($component['type'] == 'fieldset') {
foreach ($node->webform['components'] as $cid => $child_component) {
if ($child_component['pid'] == $original_cid) {
$child_component['pid'] = $new_cid;
webform_component_clone($node, $child_component);
}
}
}
return $new_cid;
}