Custom Plugins -> Set the margin and padding defaults

Hi,

Loving Beaver Builder and just this week started creating custom modules for some sites. And it works like a dream.

Just one thing I haven’t been able to work out so far. When creating the custom modules for Beaver Builder am I able to set the margin and padding defaults. Is it possible to be set when I register to the module?

Thanks.

Sorry also just realised I added this to the wrong group. Sorry and I don’t know if I can change it.

Hey Hullabaloo,

I’ve moved your post to the correct section. I’ve assigned another member of the team as well to assist you with your concern. :slight_smile:

Ben

[Content Hidden]

Hi Hullabaloo,

My apologies for the delay. Unfortunately, it’s not possible to set defaults for the advanced tab at this time.

Justin

I believe you could use the fl_builder_settings_form_defaults filter:

add_filter('fl_builder_settings_form_defaults', 'my_module_defaults', 10, 2);
public function my_module_defaults( $defaults, $form_type ) {
      if($form_type == 'my-module') {
        $defaults->margin_top = '400';
      }

      return $defaults;
    }

You could even add the filter to the module constructor –

class PrefixedMyModule extends FLBuilderModule {
    public function __construct()
    {
        parent::__construct(array(
            ...
        ));

        add_filter('fl_builder_settings_form_defaults', array($this, 'my_module_defaults'), 10, 2);
    }

    public function my_module_defaults( $defaults, $form_type ) {
      if($form_type == 'my-module') {
        $defaults->margin_top = '400';
      }

      return $defaults;
    }
}

Ah, thanks Josh. We really need to get better at documenting stuff like that. I’m actually going to be focusing on docs for a bit here soon and have added this to the list.

Justin