Created
September 13, 2021 08:37
-
-
Save techjewel/97fd2eb24d8895a8a4e27bbeb90ec89a to your computer and use it in GitHub Desktop.
Extra Form Settings for Fluent Forms
This file contains 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
<?php | |
// Inject Link Form Settings Menu | |
add_filter('fluentform_form_settings_menu', function ($items) { | |
$items['my_menu_slug'] = [ | |
'title' => 'My Menu Title', | |
'slug' => 'my_settings_slug' | |
]; | |
return $items; | |
}); | |
// Your settings callback here | |
add_action('fluentform_form_settings_container_my_settings_slug', function ($formId) { | |
$form = fluentFormApi('forms')->find($formId); | |
$formProperties = fluentFormApi('forms')->form($form); | |
// Form Inputs | |
$inputs = $formProperties->inputs(); | |
$inputLabels = $formProperties->labels(); | |
dd([$form, $inputs, $inputLabels]); | |
}); | |
/* | |
* Helper functions for form meta for storing and getting the settings | |
*/ | |
// \FluentForm\App\Helpers\Helper::setFormMeta($formId, 'YOUR_META_KEY', 'YOURMETA VALUE'); | |
// \FluentForm\App\Helpers\Helper::getFormMeta($formId, 'YOUR_META_KEY'); | |
Hello There,
As I said, You have to use fluentform_form_settings_container_my_settings_slug
action so you will get a brand new VIEW in the form the settings. Based on that you can actually output your own feed html and settings.
This is the optimal method that you can fully do whatever you want.
Regards
Hey @techjewel,
Yes, But we need multiple feed options as you have in addons, that are already completed and working well. We just need to add the show/hide text field whenever a dropdown has been selected. We don't have any selector (ID/Class) for a dropdown that we can take and show/hide our text field.
Does this make sense?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @techjewel
We have tried to add the input fields with the help of your action but it has been added at the top of every field. We need to allow them in between the other fields as we are creating the custom addon for Fluent Forms.
Is this you can help me out?