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 filter allows the switching of field types.
Formidable Forms is the best WordPress Form Builder plugin. Get it for free!
Usage
add_filter('frm_switch_field_types', 'my_custom_function', 10, 2);
Parameters
- $field_types (array): Array of field types that the currect field can switch to.
- Keys are the field type name
- Values are field type display name
- $args (array):
- type (string): current field type
- field_selection (array): List of all fields, help you get the field type display name
Examples
Allow switching from NPS to Text field
add_filter('frm_switch_field_types', 'frm_switch_nps_to_text_field', 10, 2);
function frm_switch_nps_to_text_field( $field_types, $args ) {
if ( 'nps' === $args['type'] ) {
$field_types['text'] = $args['field_selection']['text'];
}
return $field_types;
}