ACF\Pro\Datastore
Localization::serialize_field_value
Serializes a field value into the structure expected by the JS store.
For simple fields, returns the raw value. For complex fields (repeater, group, flexible content), builds a nested structure matching the ACF REST API format.
Метод класса: Localization{}
Хуков нет.
Возвращает
mixed. The serialized value.
Использование
$Localization = new Localization(); $Localization->serialize_field_value( $field, $value, $post_id );
- $field(массив) (обязательный)
- The field array.
- $value(разное) (обязательный)
- The raw field value.
- $post_id(int) (обязательный)
- The post ID.
Список изменений
| С версии 6.8.1 | Введена. |
Код Localization::serialize_field_value() Localization::serialize field value ACF 6.8.8
public function serialize_field_value( $field, $value, $post_id ) {
switch ( $field['type'] ) {
case 'repeater':
return $this->serialize_repeater_value( $field, $value, $post_id );
case 'group':
return $this->serialize_group_value( $field, $value, $post_id );
case 'flexible_content':
return $this->serialize_flexible_content_value( $field, $value, $post_id );
case 'wysiwyg':
return is_string( $value ) ? acf_esc_html( $value ) : $value;
default:
return $value;
}
}