wpcf7_swv_add_checkbox_rules()
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wpcf7_swv_add_checkbox_rules( $schema, $contact_form );
- $schema (обязательный)
- -
- $contact_form (обязательный)
- -
Код wpcf7_swv_add_checkbox_rules() wpcf7 swv add checkbox rules CF7 5.9.8
function wpcf7_swv_add_checkbox_rules( $schema, $contact_form ) { $tags = $contact_form->scan_form_tags( array( 'basetype' => array( 'checkbox', 'radio' ), ) ); foreach ( $tags as $tag ) { if ( $tag->is_required() or 'radio' === $tag->type ) { $schema->add_rule( wpcf7_swv_create_rule( 'required', array( 'field' => $tag->name, 'error' => wpcf7_get_message( 'invalid_required' ), ) ) ); } if ( 'radio' === $tag->type or $tag->has_option( 'exclusive' ) ) { $schema->add_rule( wpcf7_swv_create_rule( 'maxitems', array( 'field' => $tag->name, 'threshold' => 1, 'error' => $contact_form->filter_message( __( "Too many items are selected.", 'contact-form-7' ) ), ) ) ); } } }