Skip to content

Instantly share code, notes, and snippets.

@techjewel
Created September 13, 2021 08:37
Show Gist options
  • Save techjewel/97fd2eb24d8895a8a4e27bbeb90ec89a to your computer and use it in GitHub Desktop.
Save techjewel/97fd2eb24d8895a8a4e27bbeb90ec89a to your computer and use it in GitHub Desktop.
Extra Form Settings for Fluent Forms
<?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');
@techjewel
Copy link
Author

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

@helloarpitgshah
Copy link

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