WPCF7_SWV_MaxItemsRule::validate()
Метод класса: WPCF7_SWV_MaxItemsRule{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$WPCF7_SWV_MaxItemsRule = new WPCF7_SWV_MaxItemsRule(); $WPCF7_SWV_MaxItemsRule->validate( $context );
- $context (обязательный)
- -
Код WPCF7_SWV_MaxItemsRule::validate() WPCF7 SWV MaxItemsRule::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 ( (int) $threshold < count( $input ) ) { return new WP_Error( 'wpcf7_invalid_maxitems', $this->get_property( 'error' ) ); } return true; }