Created
June 20, 2021 12:12
-
-
Save alex-authlab/bfb5977e19468d8b3bd3ac32d02a6fbe to your computer and use it in GitHub Desktop.
fluent form input radio filter
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_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