You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fall back to the default style when a form's style was deleted - #3610
Broken: Deleting a style a form uses leaves the deleted style's ID in the form's custom_style. get_form_style_class() finds no style and adds no frm_style_* class, so the form loses its Formidable styling on the front end.
Changed:get_form_style_class() falls back to the default style when the form's style no longer exists. The stored custom_style value is not touched.
Verified:
New test_get_form_style_class_falls_back_to_default_style_when_style_is_deleted: red on the test-only commit (1 of 950 failed), green on PHP 7.4 / 8.0 / 8.2 / 8.4.
Live check on a Lite preview env: form with a custom style, then the style deleted via FrmStyle::destroy(). Wrapper class on master: frm_forms with_frm_style. On this branch: frm_forms with_frm_style frm_style_formidable-style.
Psalm is red from the existing MissingPureAnnotation/taint set; nothing on the changed lines. DeepSource PHP red was not looked into.
We reviewed changes in a0b9742...8dfea06 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
We reviewed changes in a0b9742...45e57f6 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
vivi-the-going-merryBot
changed the title
Fall back to the default style class when a form's style was deleted
Fall back to the default style when a form's style was deleted
Oct 23, 2026
The reason will be displayed to describe this comment to others. Learn more.
Approve at 45e57f6. The fix does what #6892 asks. One non-blocking note on where it sits.
Non-blocking
The same deleted-style gap is still open in FrmStylesController::get_form_style() (classes/controllers/FrmStylesController.php, ~line 1276). With a deleted style it returns null, and every caller has to patch that on its own: FrmFormsListHelper and Pro's get_active_style_for_form() already carry their own "second pass to avoid null values" default lookup, and this PR adds a third in get_form_style_class(). Callers without one still get null: get_style_val() (used by Pro's FrmProField.php:23auto_width, FrmProStylesController::enqueue_jquery_css()theme_css, FrmProEntriesController), get_active_style() (field alignment), FrmProFieldDivider::maybe_add_collapse_icon() (get_settings_for_output( null )), and FrmProFieldsController.php:869 (RTL). Measured on the preview env after deleting the form's style: get_form_style( $form_id ) is not an object, and get_style_val( 'radio_align', $form_id ) is NULL where the default style gives block. I did not find a visible symptom from these on the front end (the radio field kept vertical_radio because Pro's own field option covers it), so I am not blocking.
Moving the fallback into get_form_style() (if ( ! $style ) { $style = 'default'; } before the new FrmStyle( $style )) would fix the class and all of those in one place, and the two existing call-site fallbacks could then go. The PR's own test would still pass, since get_form_style_class() takes the style ID directly, so keep the current change or call get_form_style() from it. Your call whether that belongs in this PR or a follow-up.
What I ran
Reproduced #6892 on the preview env (Lite + Pro, form with a radio field and a custom style, then FrmStyle::destroy() on that style). Wrapper class: before the delete frm_forms with_frm_style frm_style_frankyprobe. After the delete on master: frm_forms with_frm_style (the bug). After the delete on this branch: frm_forms with_frm_style frm_style_formidable-style, identical to a form set to the default style. HTML captured over HTTP, not a rendered page.
CI: PHPUnit passes on PHP 7.4/8.0/8.2/8.4. Psalm is red, but master's own Psalm run on a0b9742 fails too. I did not run the new test locally, and did not look into the DeepSource PHP failure (inline comments are on the test file).
Generalization grep for the same pattern: see the note above. The custom_style option still holds the deleted ID, as the PR says.
Not exercised: a rendered front-end page or screenshot of the styled form (class output only), the Styles admin screens after a delete, Pro with a deleted style in the Styler preview, review skills (time).
Re the non-blocking note on get_form_style(): keeping the fix in get_form_style_class(). Moving the fallback into get_form_style() changes what every Lite and Pro caller gets for a deleted style, which I have not exercised. Better as its own follow-up.
Agreed, thanks. Keeping the fix in get_form_style_class() is fine, and the get_form_style() change affects every Lite and Pro caller of a deleted style, so it deserves its own follow-up with its own check. My Approve at 45e57f6 stands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Strategy11/formidable-pro#6892
Broken: Deleting a style a form uses leaves the deleted style's ID in the form's
custom_style.get_form_style_class()finds no style and adds nofrm_style_*class, so the form loses its Formidable styling on the front end.Changed:
get_form_style_class()falls back to the default style when the form's style no longer exists. The storedcustom_stylevalue is not touched.Verified:
test_get_form_style_class_falls_back_to_default_style_when_style_is_deleted: red on the test-only commit (1 of 950 failed), green on PHP 7.4 / 8.0 / 8.2 / 8.4.FrmStyle::destroy(). Wrapper class on master:frm_forms with_frm_style. On this branch:frm_forms with_frm_style frm_style_formidable-style.MissingPureAnnotation/taint set; nothing on the changed lines. DeepSource PHP red was not looked into.Before (master), unstyled submit button:
After (this branch), default style applied:
🤖 Generated with Claude Code