From 8dfea069ad24c3bd5d761b8447adf782cc6a9168 Mon Sep 17 00:00:00 2001 From: "vivi-the-going-merry[bot]" <308115520+vivi-the-going-merry[bot]@users.noreply.github.com> Date: Thu, 22 Oct 2026 19:40:59 -0600 Subject: [PATCH 1/2] Add failing test: deleted style should fall back to the default style class Co-Authored-By: Claude Sonnet 5.5 --- tests/phpunit/styles/test_FrmStylesController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/phpunit/styles/test_FrmStylesController.php b/tests/phpunit/styles/test_FrmStylesController.php index a80f158abd..ed7d7c75df 100644 --- a/tests/phpunit/styles/test_FrmStylesController.php +++ b/tests/phpunit/styles/test_FrmStylesController.php @@ -185,4 +185,16 @@ public function test_save() { $updated_style = $frm_style->get_one(); $this->assertSame( $style->post_title . ' Updated', $updated_style->post_title ); } + + public function test_get_form_style_class_falls_back_to_default_style_when_style_is_deleted() { + $default_style = ( new FrmStyle( 'default' ) )->get_one(); + $this->assertNotEmpty( $default_style ); + + $deleted_style_id = $default_style->ID + 100000; + $this->assertNull( ( new FrmStyle( $deleted_style_id ) )->get_one() ); + + $class = FrmStylesController::get_form_style_class( ' with_frm_style', $deleted_style_id ); + + $this->assertSame( ' with_frm_style frm_style_' . $default_style->post_name, $class ); + } } From 45e57f6169d37ef1fd5f7a99ef54925643f41cf2 Mon Sep 17 00:00:00 2001 From: "vivi-the-going-merry[bot]" <308115520+vivi-the-going-merry[bot]@users.noreply.github.com> Date: Thu, 22 Oct 2026 19:44:50 -0600 Subject: [PATCH 2/2] Fall back to the default style class when the form's style was deleted Co-Authored-By: Claude Sonnet 5.5 --- classes/controllers/FrmStylesController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/classes/controllers/FrmStylesController.php b/classes/controllers/FrmStylesController.php index 8be5d031f0..077a1904b4 100644 --- a/classes/controllers/FrmStylesController.php +++ b/classes/controllers/FrmStylesController.php @@ -1348,6 +1348,11 @@ public static function get_form_style_class( $class, $style ) { $frm_style = new FrmStyle( $style ); $style = $frm_style->get_one(); + if ( ! $style ) { + // The style was deleted, so use the default style. + $style = ( new FrmStyle( 'default' ) )->get_one(); + } + if ( $style ) { $class .= ' frm_style_' . $style->post_name; self::maybe_add_rtl_class( $style, $class );