WPCF7_SWV_MinItemsRule::validate()
Метод класса: WPCF7_SWV_MinItemsRule{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$WPCF7_SWV_MinItemsRule = new WPCF7_SWV_MinItemsRule(); $WPCF7_SWV_MinItemsRule->validate( $context );
- $context (обязательный)
- -
Код WPCF7_SWV_MinItemsRule::validate() WPCF7 SWV MinItemsRule::validate CF7 5.7.3
public function validate( $context ) { $field = $this->get_property( 'field' ); $input = isset( $_POST[$field] ) ? $_POST[$field] : ''; $input = wpcf7_array_flatten( $input ); $input = wpcf7_exclude_blank( $input ); $threshold = $this->get_property( 'threshold' ); if ( ! wpcf7_is_number( $threshold ) ) { return true; } if ( count( $input ) < (int) $threshold ) { return new WP_Error( 'wpcf7_invalid_minitems', $this->get_property( 'error' ) ); } return true; }