wpcf7_swv_add_file_rules()
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wpcf7_swv_add_file_rules( $schema, $contact_form );
- $schema (обязательный)
- -
- $contact_form (обязательный)
- -
Код wpcf7_swv_add_file_rules() wpcf7 swv add file rules CF7 5.9.8
function wpcf7_swv_add_file_rules( $schema, $contact_form ) { $tags = $contact_form->scan_form_tags( array( 'basetype' => array( 'file' ), ) ); foreach ( $tags as $tag ) { if ( $tag->is_required() ) { $schema->add_rule( wpcf7_swv_create_rule( 'requiredfile', array( 'field' => $tag->name, 'error' => wpcf7_get_message( 'invalid_required' ), ) ) ); } $schema->add_rule( wpcf7_swv_create_rule( 'file', array( 'field' => $tag->name, 'accept' => explode( ',', wpcf7_acceptable_filetypes( $tag->get_option( 'filetypes' ), 'attr' ) ), 'error' => wpcf7_get_message( 'upload_file_type_invalid' ), ) ) ); $schema->add_rule( wpcf7_swv_create_rule( 'maxfilesize', array( 'field' => $tag->name, 'threshold' => $tag->get_limit_option(), 'error' => wpcf7_get_message( 'upload_file_too_large' ), ) ) ); } }