Skip to content

Instantly share code, notes, and snippets.

@alex-authlab
Created June 20, 2021 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-authlab/bfb5977e19468d8b3bd3ac32d02a6fbe to your computer and use it in GitHub Desktop.
Save alex-authlab/bfb5977e19468d8b3bd3ac32d02a6fbe to your computer and use it in GitHub Desktop.
fluent form input radio filter
add_filter('fluenform_rendering_field_data_input_radio', function ($data, $form) {
if ($form->id != 91) {
return $data;
}
// check if the name attriibute is 'checkbox', make sure it mathc
if (\FluentForm\Framework\Helpers\ArrayHelper::get($data, 'attributes.name') != 'checkbox') {
return $data;
}
// We are merging with existing options here
$data['settings']['advanced_options'] = array_merge($data['settings']['advanced_options'], [
[
"label" => "Dynamic Option 1",
"value" => "Dynamic Option 1",
"calc_value" => "",
"id" => 9,
],
[
"label" => "Dynamic Option 2",
"value" => "Dynamic Option 2",
"calc_value" => "",
"id" =>10,
]
]);
return $data;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment