Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This action hook fires after duplicating a field.
Usage
add_action('frm_after_duplicate_field', 'my_custom_function', 10, 2);
Parameters
- $args (array)
- field_id (new field ID)
- values (values before inserting new field)
- copy_field
- form_id
Examples
Save the ID of copy field to new field option
add_action('frm_after_duplicate_field', 'frm_save_id_duplicate_field', 10, 2);
function frm_save_id_duplicate_field( $args ) {
$new_field_options = $args['values']['field_options'];
$new_field_options['copied_from'] = $args['copy_field']->id;
FrmField::update( $args['field_id'], array( 'field_options' => $new_field_options ) );
}