Custom Plugins -> Set the margin and padding defaults

About this forum
These forums have not been active for several years. They're available for search and reference, but a lot of this information is likely out of date.

For current information, try visiting our Knowledge Base.

Home / Support / Custom Module Development / Custom Plugins -> Set the margin and padding defaults

This topic is: not resolved
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #94481

    hullabaloo
    Participant

    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.

    #94482

    hullabaloo
    Participant

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

    #94490

    Ben Carlo
    Keymaster

    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. 🙂

    Ben

    #94494

    hullabaloo
    Participant
    This reply has been marked as private.
    #97286

    Justin Busa
    Keymaster

    Hi Hullabaloo,

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

    Justin

    #97458

    Josh C
    Participant

    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;
        }
    }
    #97460

    Justin Busa
    Keymaster

    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

Viewing 7 posts - 1 through 7 (of 7 total)

The forum ‘Custom Module Development’ is closed to new topics and replies.