acf_field_gallery::validate_rest_value
Validates file fields updated via the REST API.
Метод класса: acf_field_gallery{}
Хуков нет.
Возвращает
true|false|WP.
Использование
$acf_field_gallery = new acf_field_gallery(); $acf_field_gallery->validate_rest_value( $valid, $value, $field );
- $valid(true|false) (обязательный)
- The current validity booleean.
- $value(int) (обязательный)
- The value of the field.
- $field(массив) (обязательный)
- The field array.
Код acf_field_gallery::validate_rest_value() acf field gallery::validate rest value ACF 6.4.2
public function validate_rest_value( $valid, $value, $field ) {
if ( ! $valid || ! is_array( $value ) ) {
return $valid;
}
foreach ( $value as $attachment_id ) {
$file_valid = acf_get_field_type( 'file' )->validate_rest_value( $valid, $attachment_id, $field );
if ( is_wp_error( $file_valid ) ) {
return $file_valid;
}
}
return $valid;
}