From cf294722c0c4f43401a969a3fe300257ada32bcf Mon Sep 17 00:00:00 2001 From: atanas-angelov-dev Date: Mon, 17 Jul 2017 16:35:51 +0300 Subject: [PATCH] fix sidebar field due to changes in select field --- core/Field/Sidebar_Field.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/Field/Sidebar_Field.php b/core/Field/Sidebar_Field.php index bdcb8ba90..1a59c3f72 100644 --- a/core/Field/Sidebar_Field.php +++ b/core/Field/Sidebar_Field.php @@ -52,6 +52,12 @@ public function to_json( $load ) { $field_data = parent::to_json( $load ); + // override default value assigning behavior since sidebars are + // loaded separately and not as a part of the field options + $field_data = array_merge( $field_data, array( + 'value' => $this->get_formatted_value(), + ) ); + if ( ! empty( $this->excluded_sidebars ) ) { if ( ! is_array( $this->excluded_sidebars ) ) { $this->excluded_sidebars = array( $this->excluded_sidebars );