Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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');
@helloarpitgshah

This comment has been minimized.

Copy link

@helloarpitgshah helloarpitgshah commented Sep 20, 2021

Hey,

Thank you for your code snippet.

But we are creating our plugin with multiple feeds as you have an option.

We need to add JS click events whenever we are going to selecting the dropdown menu from one of the feeds elements.

As like whenever users are going to select dropdowns as we need to show the text fields. We need JS code from you that can allow us to have options to make this work.

Does this make sense?

Thanks,
Arpit G Shah

@techjewel

This comment has been minimized.

Copy link
Owner Author

@techjewel techjewel commented Sep 24, 2021

Hi @helloarpitgshah
in the fluentform_form_settings_container_my_settings_slug you can load your own scripts and HTML or whatever you want and make the settings and UI. If you load any custom js please make sure keep the fluentform in the file name.

@helloarpitgshah

This comment has been minimized.

Copy link

@helloarpitgshah helloarpitgshah commented Sep 30, 2021

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?

@techjewel

This comment has been minimized.

Copy link
Owner Author

@techjewel techjewel commented Oct 4, 2021

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

This comment has been minimized.

Copy link

@helloarpitgshah helloarpitgshah commented Oct 4, 2021

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