wpcf7_swv_add_textarea_rules()
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wpcf7_swv_add_textarea_rules( $schema, $contact_form );
- $schema (обязательный)
- -
- $contact_form (обязательный)
- -
Код wpcf7_swv_add_textarea_rules() wpcf7 swv add textarea rules CF7 5.9.8
function wpcf7_swv_add_textarea_rules( $schema, $contact_form ) { $tags = $contact_form->scan_form_tags( array( 'basetype' => array( 'textarea' ), ) ); foreach ( $tags as $tag ) { if ( $tag->is_required() ) { $schema->add_rule( wpcf7_swv_create_rule( 'required', array( 'field' => $tag->name, 'error' => wpcf7_get_message( 'invalid_required' ), ) ) ); } if ( $minlength = $tag->get_minlength_option() ) { $schema->add_rule( wpcf7_swv_create_rule( 'minlength', array( 'field' => $tag->name, 'threshold' => absint( $minlength ), 'error' => wpcf7_get_message( 'invalid_too_short' ), ) ) ); } if ( $maxlength = $tag->get_maxlength_option( '2000' ) ) { $schema->add_rule( wpcf7_swv_create_rule( 'maxlength', array( 'field' => $tag->name, 'threshold' => absint( $maxlength ), 'error' => wpcf7_get_message( 'invalid_too_long' ), ) ) ); } } }