wpcf7_swv_add_date_rules()
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wpcf7_swv_add_date_rules( $schema, $contact_form );
- $schema (обязательный)
- -
- $contact_form (обязательный)
- -
Код wpcf7_swv_add_date_rules() wpcf7 swv add date rules CF7 5.9.8
function wpcf7_swv_add_date_rules( $schema, $contact_form ) { $tags = $contact_form->scan_form_tags( array( 'basetype' => array( 'date' ), ) ); 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' ), ) ) ); } $schema->add_rule( wpcf7_swv_create_rule( 'date', array( 'field' => $tag->name, 'error' => wpcf7_get_message( 'invalid_date' ), ) ) ); $min = $tag->get_date_option( 'min' ); $max = $tag->get_date_option( 'max' ); if ( false !== $min ) { $schema->add_rule( wpcf7_swv_create_rule( 'mindate', array( 'field' => $tag->name, 'threshold' => $min, 'error' => wpcf7_get_message( 'date_too_early' ), ) ) ); } if ( false !== $max ) { $schema->add_rule( wpcf7_swv_create_rule( 'maxdate', array( 'field' => $tag->name, 'threshold' => $max, 'error' => wpcf7_get_message( 'date_too_late' ), ) ) ); } } }