acf_field_image::validate_value
This function will validate a basic file input
Метод класса: acf_field_image{}
Хуков нет.
Возвращает
boolean. The validity status.
Использование
$acf_field_image = new acf_field_image(); $acf_field_image->validate_value( $valid, $value, $field, $input );
- $valid(true|false) (обязательный)
- The current validity status.
- $value(разное) (обязательный)
- The field value.
- $field(массив) (обязательный)
- The field array.
- $input(строка) (обязательный)
- The name of the input in the POST object.
Список изменений
| С версии 5.0.0 | Введена. |
Код acf_field_image::validate_value() acf field image::validate value ACF 6.8.8
public function validate_value( $valid, $value, $field, $input ) {
if ( $valid !== true ) {
return $valid;
}
if ( empty( $value ) ) {
return $valid;
}
if ( is_numeric( $value ) && ! wp_attachment_is_image( $value ) ) {
return __( 'File must be a valid image.', 'acf' );
}
return acf_get_field_type( 'file' )->validate_value( $valid, $value, $field, $input );
}