From c095ba79070d8ae2a61934d61179e533ca5ab6fd Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Fri, 18 Oct 2024 12:34:02 +0530 Subject: [PATCH 1/3] Override the individual quiz text data in quiz options --- php/classes/class-qsm-settings.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/php/classes/class-qsm-settings.php b/php/classes/class-qsm-settings.php index 5046ca6e..25be0d6b 100644 --- a/php/classes/class-qsm-settings.php +++ b/php/classes/class-qsm-settings.php @@ -471,13 +471,7 @@ public function get_quiz_options() { } $text = $this->get_setting('quiz_text'); - if ( is_array($text) ) { - foreach ( $text as $key => $value ) { - if ( ! empty($value) ) { - $quiz_options[ $key ] = $value; - } - } - } + $quiz_options = array_merge( $quiz_options, $text ); // Return as old object model return (object) $quiz_options; From 2bcb27df2b31825f46ec163045d6d63c41a36e7e Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Fri, 18 Oct 2024 13:13:55 +0530 Subject: [PATCH 2/3] added previous condition --- php/classes/class-qsm-settings.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/php/classes/class-qsm-settings.php b/php/classes/class-qsm-settings.php index 25be0d6b..2053d265 100644 --- a/php/classes/class-qsm-settings.php +++ b/php/classes/class-qsm-settings.php @@ -471,6 +471,13 @@ public function get_quiz_options() { } $text = $this->get_setting('quiz_text'); + if ( is_array($text) ) { + foreach ( $text as $key => $value ) { + if ( ! empty($value) ) { + $quiz_options[ $key ] = $value; + } + } + } $quiz_options = array_merge( $quiz_options, $text ); // Return as old object model From 2e22491457d72375a073f660b34b08c59c28f950 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Fri, 18 Oct 2024 16:00:58 +0530 Subject: [PATCH 3/3] fix condition to merge text array --- php/classes/class-qsm-settings.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/php/classes/class-qsm-settings.php b/php/classes/class-qsm-settings.php index 2053d265..916afe61 100644 --- a/php/classes/class-qsm-settings.php +++ b/php/classes/class-qsm-settings.php @@ -472,13 +472,8 @@ public function get_quiz_options() { $text = $this->get_setting('quiz_text'); if ( is_array($text) ) { - foreach ( $text as $key => $value ) { - if ( ! empty($value) ) { - $quiz_options[ $key ] = $value; - } - } + $quiz_options = array_merge( $quiz_options, $text ); } - $quiz_options = array_merge( $quiz_options, $text ); // Return as old object model return (object) $quiz_options;