Last active
January 27, 2019 15:01
-
-
Save New0/43675dc394fef1510eba33668b7dcf5f to your computer and use it in GitHub Desktop.
Caldera Forms. Add disabled attribute to options in Checkbox, Dropdown and Select 2 fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Example of how to use a Disabled attribute for options in Checkbox, dropdown or select 2 fields | |
add_filter( 'caldera_forms_render_get_field', function( $field ) { | |
if( 'fld_4425558' === $field[ 'ID' ] ){ //Field ID => 'fld_4425558' | |
$field[ 'config' ][ 'option' ]['opt1996332']['disabled'] = true; // Option ID => 'opt1996332' | |
} else if( 'fld_7668742' === $field[ 'ID' ] ){ //Field ID => 'fld_7668742' | |
$field[ 'config' ][ 'option' ]['opt3137985']['disabled'] = true; // Option ID => 'opt3137985' | |
} else if( 'fld_381620' === $field[ 'ID' ] ){ //Field ID => 'fld_381620' | |
$field[ 'config' ][ 'option' ]['opt1172954']['disabled'] = true; // Option ID => 'opt1172954' | |
} | |
return $field; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment