acf_field_file::validate_value()
validate_value
This function will validate a basic file input
Метод класса: acf_field_file{}
Хуков нет.
Возвращает
$post_id
. (int)
Использование
$acf_field_file = new acf_field_file(); $acf_field_file->validate_value( $valid, $value, $field, $input );
- $valid (обязательный)
- -
- $value (обязательный)
- -
- $field (обязательный)
- -
- $input (обязательный)
- -
Список изменений
С версии 5.0.0 | Введена. |
Код acf_field_file::validate_value() acf field file::validate value ACF 6.0.4
function validate_value( $valid, $value, $field, $input ) { // bail early if empty if ( empty( $value ) ) { return $valid; } // bail early if is numeric if ( is_numeric( $value ) ) { return $valid; } // bail early if not basic string if ( ! is_string( $value ) ) { return $valid; } // decode value $file = null; parse_str( $value, $file ); // bail early if no attachment if ( empty( $file ) ) { return $valid; } // get errors $errors = acf_validate_attachment( $file, $field, 'basic_upload' ); // append error if ( ! empty( $errors ) ) { $valid = implode( "\n", $errors ); } // return return $valid; }