New function FrmForm::prepare_form_row_data#1547
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1547 +/- ##
============================================
+ Coverage 29.45% 29.54% +0.08%
- Complexity 7696 7735 +39
============================================
Files 115 115
Lines 25404 25482 +78
============================================
+ Hits 7484 7529 +45
- Misses 17920 17953 +33 ☔ View full report in Codecov by Sentry. |
|
@Crabcyborg Hi!
-[ x ]Added field and updated the form successfully |
|
Thanks @joaovictorangeline. I'm thinking we may want to set the default form options instead of an empty array to solve that issue. |
Yes, @Crabcyborg when I enabled the default style, it worked fine! |
|
Here's a more up to date pre-release you can share that should fix that issue as well, I went ahead and started using the lite defaults when there are no options. This includes the |
|
I tested and it worked @Crabcyborg ! |
FrmForm::prepare_form_row_data
stephywells
left a comment
There was a problem hiding this comment.
This looks like a great approach.
- I think it's fine to not set the defaults for the pro options. The code should handle that already since many forms would start as lite forms before an upgrade.
- That sounds like a good adjustment to only run the hook if it's an object.
Related ticket https://secure.helpscout.net/conversation/2518729092/191090/
A lot of code works on the assumption that
$form->optionsis an array.I tried adding some checks in some updates yesterday (in #1543, https://github.com/Strategy11/formidable-pro/pull/4845 and https://github.com/Strategy11/formidable-pro/pull/4844) but I think we're better off just forcing
$form->optionsas an array right away. Trying to fix this in every place where we assume$form->optionsis an array is turning into too much work and too many undetected bugs.This update now forces all results from
FrmForm::getOneto have an array$form->optionsvalue when$formis not null. I used the lite form defaults so some basic keys are defined, to help fix an issue with a PHP warning.Questions
FrmFormsHelper::get_default_opts()as well to define some Pro defaults?frm_form_objectwhen it's an object and not null? That might help with stability as well.Coming from this line of code:
Since
$optionsis a string, trying to set$options['trash_time']triggers a fatal error.