acf_field_email::validate_value()
Validate the email value. If this method returns TRUE, the input value is valid. If FALSE or a string is returned, the input value is invalid and the user is shown a notice. If a string is returned, the string is show as the message text.
Метод класса: acf_field_email{}
Хуков нет.
Возвращает
true|false|Строку
.
Использование
$acf_field_email = new acf_field_email(); $acf_field_email->validate_value( $valid, $value, $field, $input );
- $valid(true|false) (обязательный)
- Whether the value is valid.
- $value(разное) (обязательный)
- The field value.
- $field(массив) (обязательный)
- The field array.
- $input(строка) (обязательный)
- The request variable name for the inbound field.
Код acf_field_email::validate_value() acf field email::validate value ACF 6.0.4
public function validate_value( $valid, $value, $field, $input ) { $flags = defined( 'FILTER_FLAG_EMAIL_UNICODE' ) ? FILTER_FLAG_EMAIL_UNICODE : 0; if ( $value && filter_var( wp_unslash( $value ), FILTER_VALIDATE_EMAIL, $flags ) === false ) { return sprintf( __( "'%s' is not a valid email address", 'acf' ), esc_html( $value ) ); } return $valid; }