New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SFT-1074]: Hidden Group Field refactor to use db tables #1248
Conversation
)} | ||
</GroupWrapper> | ||
))} | ||
{data.groups.grouped?.map( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not have changed the front-end at all, all of this logic needs to be in the backend.
You previously returned hidden
and groups
in the response, this can still remain exactly like that, just pick the hidden
fields out of the array in the backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course
if (!empty($hiddenTypes)) { | ||
$groupRecord = new FieldTypeGroupRecord(); | ||
$groupRecord->uid = 'hidden'; | ||
$groupRecord->types = json_encode($hiddenTypes); | ||
$groupRecord->save(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, what if I have hidden groups set up already? Would this not trigger an error, saying that a record like this already exists?
Also I think using uid
is not very safe, something might rely on all db rows using UUID v4
.
How about using a record with handle freeform_hidden
?
And before addinga new one, try to fetch one from the db by FieldTypeGroupRecord::findOne(['handle' => 'freeform_hidden']);
Related Ticket Number
SFT-1074
Description
Hidden Field Type group was saving data to the Freeform Settings model, and this caused issues for people using
allowAdminChanges => false
, who then were not able to persist the changes for field groups.