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.
Add extra settings in the 'Default Value' section in the field settings.
Usage
add_action( 'frm_default_value_setting', 'add_custom_field_setting' ); function add_custom_field_setting( $args )
Parameters
- $args (array)
- 'field' (array)
- 'display' (array) - A list of field options that should be shown for the current field.
- 'default_value_types' (array) - The types of default values this field allows.
Examples
Add a custom setting below the default value setting
In this code example, the custom setting will be displayed below the default value option when a star field type is selected.
add_action( 'frm_default_value_setting', 'after_default_value_setting' );
function after_default_value_setting( $args ) {
$field = $args['field'];
$value = isset( $field['default_value'] ) ? $field['default_value'] : '';
if ( 'star' === $field['type'] ) {
?>
<label>
<input type="checkbox" value="1" name="field_options[custom_setting_<?php checked( $value, 1 ); ?>]" />
<?php esc_html_e( 'Custom setting', 'text-domain' ); ?>
</label>
<?php
}
}