function webform_component_update in Webform 6.3
Same name and namespace in other branches
- 5.2 webform_components.inc \webform_component_update()
- 6.2 webform_components.inc \webform_component_update()
- 7.4 includes/webform.components.inc \webform_component_update()
- 7.3 includes/webform.components.inc \webform_component_update()
Update an existing component with new values.
Parameters
$component: A full component containing a nid, cid, and all other fields from the component form. Additional properties are stored in the extra array.
2 calls to webform_component_update()
- webform_component_edit_form_submit in includes/
webform.components.inc - Submit handler for webform_component_edit_form().
- webform_node_update in ./
webform.module - Implements hook_node_update().
File
- includes/
webform.components.inc, line 774 - Webform module component handling.
Code
function webform_component_update($component) {
// Allow modules to modify the component before saving.
foreach (module_implements('webform_component_presave') as $module) {
$function = $module . '_webform_component_presave';
$function($component);
}
$component['value'] = isset($component['value']) ? $component['value'] : NULL;
$component['mandatory'] = isset($component['mandatory']) ? $component['mandatory'] : 0;
$component['extra']['private'] = isset($component['extra']['private']) ? $component['extra']['private'] : 0;
$success = db_query("UPDATE {webform_component} SET pid = %d, form_key = '%s', name = '%s', type = '%s', value = '%s', extra = '%s', mandatory = %d, weight = %d WHERE nid = %d AND cid = %d", $component['pid'], $component['form_key'], $component['name'], $component['type'], $component['value'], serialize($component['extra']), $component['mandatory'], $component['weight'], $component['nid'], $component['cid']);
// Post-update actions.
module_invoke_all('webform_component_update', $component);
return $success;
}