Description
Use this action hook to perform actions right after a field is deleted from a form.
Usage
<?php
add_action("gform_after_delete_field", "do_cleanup", 10, 2);
?>
Parameters
$form_id
- (int) ID of current form.
$field_id
- (int) ID of deleted field.
Examples
This example adds a log file entry when a field is deleted.
<?php
add_action("gform_after_delete_field", "log_deleted_field", 10, 2);
function log_deleted_field($form_id, $field_id){
$log_file = ABSPATH . "/gf_deleted_fields.log";
$f = fopen($log_file, "a");
$user = wp_get_current_user();
fwrite($f, date("c") . " - Field deleted by {$user->user_login}. Form ID: {$form_id}. Field ID: {$field_id} \n");
fclose($f);
}
?>
Source Code
This action hook is located in form_model.php