Custom settings and preview

I am building a custom settings file to use in my module as in this example:
http://take.ms/kQF41

On the settings page I am only displaying settings based on other factors and settings. How do I use the default BB settings fields within this page such as the ‘color’ picker and other settings. I also need the preview function to work as well?

Thanks

Hey David,

Great question! We really should have that documented, sorry :slight_smile:

To do that, you’ll need to use the FLBuilder::render_settings_field method like so…

FLBuilder::render_settings_field( 'field_slug', array(
    	'type'          => 'text',
    	'label'         => __( 'Service', 'fl-builder' ),
), $settings ); 

The array takes all of the same values as a normal config array for a setting field.

Let me know if you have any questions about that.

Justin

Perfect…Thank you.

One more question. On my custom settings page I am trying to show and hide settings based on another setting within another tab. So another words the user selects an option on the General tab and on the Style tab it will show and hide styling options based on what they choose from the General tab settings.
On the custom settings page (Style tab) a can use the $settings value to call in the value from the setting on the General tab. However, the user needs to save the module settings before I can use the $settings true live value on the Style tab. The problem is that if I force the user the save the module on the General tab before they can use the Style tab, the module closes making the user reopen the module settings to style the tab.
Is there a way around this? I can’t use toggle as the setting on the the General tab is a select dropdown and the value is dynamic (never the same values).
I think the only option is custom JS to hide and show the settings based on what the user selected on the General tab.
Hope this makes sense…let me know your thoughts.

Hey David,

I think custom JS is the way to go here. That can be added in my-plugin/my-module/js/settings.js. What do you think about going that route?

Justin

Thanks Justin. That is actually what I had decided to end up doing as I figured there be no other way.

Great! Let me know if there is anything else.