function webform_component_delete_form_submit in Webform 7.3
Same name and namespace in other branches
- 5.2 webform_components.inc \webform_component_delete_form_submit()
- 6.3 includes/webform.components.inc \webform_component_delete_form_submit()
- 6.2 webform_components.inc \webform_component_delete_form_submit()
- 7.4 includes/webform.components.inc \webform_component_delete_form_submit()
Submit handler for webform_component_delete_form().
File
- includes/
webform.components.inc, line 725 - Webform module component handling.
Code
function webform_component_delete_form_submit($form, &$form_state) {
// Delete the component.
$node = $form_state['values']['node'];
$component = $form_state['values']['component'];
webform_component_delete($node, $component);
drupal_set_message(t('Component %name deleted.', array(
'%name' => $component['name'],
)));
// Check if this webform still contains any information.
unset($node->webform['components'][$component['cid']]);
webform_check_record($node);
// Since Webform components have been updated but the node itself has not
// been saved, it is necessary to explicitly clear the cache to make sure
// the updated webform is visible to anonymous users.
cache_clear_all();
// Clear the entity cache if Entity Cache module is installed.
if (module_exists('entitycache')) {
entity_get_controller('node')
->resetCache(array(
$node->nid,
));
}
$form_state['redirect'] = 'node/' . $node->nid . '/webform/components';
}