acf_field_checkbox::update_value
Filters the $value before it is updated in the db.
Метод класса: acf_field_checkbox{}
Хуков нет.
Возвращает
mixed.
Использование
$acf_field_checkbox = new acf_field_checkbox(); $acf_field_checkbox->update_value( $value, $post_id, $field );
- $value(разное) (обязательный)
- The value which will be saved in the database.
- $post_id(int|строка) (обязательный)
- The post_id of which the value will be saved.
- $field(массив) (обязательный)
- The field array holding all the field options.
Список изменений
| С версии 3.6 | Введена. |
Код acf_field_checkbox::update_value() acf field checkbox::update value ACF 6.8.8
function update_value( $value, $post_id, $field ) {
// bail early if is empty
if ( empty( $value ) ) {
return $value;
}
// select -> update_value()
$value = acf_get_field_type( 'select' )->update_value( $value, $post_id, $field );
// save_custom
if ( $field['save_custom'] ) {
// get raw $field (may have been changed via repeater field)
// if field is local, it won't have an ID
$selector = $field['ID'] ? $field['ID'] : $field['key'];
$field = acf_get_field( $selector );
if ( ! $field ) {
return false;
}
// bail early if no ID (JSON only)
if ( ! $field['ID'] ) {
return $value;
}
acf_get_field_type( 'select' )->append_user_choices_to_field( $value, $post_id, $field );
}
// return
return $value;
}