Last active
September 20, 2019 13:54
-
-
Save New0/be22a63af2fbc1ff005a503b24604033 to your computer and use it in GitHub Desktop.
Plugin to set the maxlength to multiple Caldera Forms paragraphs fields
This file contains 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 | |
/** | |
* Plugin Name: CF paragraph settings | |
* | |
*/ | |
add_filter( 'caldera_forms_field_attributes', function( $attrs, $field, $form ){ | |
//Set the field IDs here | |
$fields = [ 'fld_456', 'fld_457', 'fld_458' ]; | |
if( in_array( $field[ 'ID' ], $fields) && 'paragraph' === Caldera_Forms_Field_Util::get_type( $field, $form ) ){ | |
$attrs[ 'maxlength' ] = 75; | |
} | |
return $attrs; | |
}, 20, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment