Created
May 12, 2020 11:52
-
-
Save reachkamrul/eff3d26fc22242f7a00c45916070ff76 to your computer and use it in GitHub Desktop.
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 dynamic data to fluent form | |
add_filter('fluenform_rendering_field_data_select', function ($data, $form) { | |
// Add data to formID 91, you can change the id with your particular form id | |
if ($form->id != 91) { | |
return $data; | |
} | |
// select only the dropdown name attribute | |
// change 'dynamic_dropdown' name with your fields dropdown name | |
if (\FluentForm\Framework\Helpers\ArrayHelper::get($data, 'attributes.name') != 'dynamic_dropdown') { | |
return $data; | |
} | |
$data['settings']['advanced_options'] = array_merge($data['settings']['advanced_options'], [ | |
[ | |
"label" => "Dynamic Option 1", // This is field label | |
"value" => "Dynamic Option 1", // This is field value | |
"calc_value" => "" | |
], | |
[ | |
"label" => "Dynamic Option 2", // This is field label | |
"value" => "Dynamic Option 2", // This is field value | |
"calc_value" => "" | |
] | |
// You can add as many data you want, just add with a comma, just like above | |
]); | |
return $data; | |
}, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment