Adding notes to Beaver Builder modules

Adding notes to Beaver Builder modules

James from Implexa Solutions asked:

 

I am working on a pretty big and complex project and I was thinking today that I wish there was a way I could add a comment to a module, column or row settings area.

For example, I have a gallery that the images need to by 300×300 to look right, so I would like to be able to leave myself a note if you will on the module, so I don’t have to open the gallery and go look at the photo settings to find the size.  Another example, say I have a row that has custom CSS, I would like be able to call that out right from the General Tab, so I don’t have to go over to the advanced tab and scroll down to figure out that I have a custom class in play.

The answer is yes, it is possible! Here’s a little snippet to add to your functions.php file or similar…

 

Add notes to the ‘Advanced’ Tab

/* Add the notes field to all BB modules, rows, columns. Notes field found in the advanced tab.
 * With love from https://sitespot.dev
 */
  function bt_register_notes( $form, $slug ) {
  
	if ( 'module_advanced' === $slug ) {
    $form[ 'sections' ][ 'css_selectors' ][ 'fields' ][ 'bt_notes' ] = [
            'type'          => 'textarea',
            'label'         => 'Your Notes (Not displayed on website)',
            'placeholder'   => 'Notes',
            'rows'          => '6'
        ];  
  }
    
	if ( 'col' === $slug || 'row' === $slug ) {
		$form[ 'tabs' ][ 'advanced' ][ 'sections' ][ 'css_selectors' ][ 'fields' ][ 'bt_notes' ] = [
            'type'          => 'textarea',
            'label'         => 'Your Notes (Not displayed on website)',
            'placeholder'   => 'Notes',
            'rows'          => '6'
        ];  
  }
  return $form;    
}
add_filter( 'fl_builder_register_settings_form', 'bt_register_notes', 100, 2 );

 

An alternative, add notes to the first tab

BT Pro Notes
/* Add the notes field to all BB modules, rows, columns. Updated, now on the 'Home Tab'
 * With love from https://sitespot.dev
 */
  function bt_register_notes( $form, $slug ) {
  
  $key = key($form);
    
	$excluded_modules = array(
    'user_template', 
    'node_template', 
    'uabb-global',
    'global',
    'layout',
    'module_advanced',
    'custom_post_layout');
    
	if ( 'col' === $slug || 'row' === $slug ) {
    
		$form[ 'tabs' ][ 'style' ][ 'sections' ][ 'general' ][ 'fields' ][ 'bt_notes' ] = [
            'type'          => 'textarea',
            'label'         => 'Your Notes (Not displayed on website)',
            'placeholder'   => 'Notes',
            'rows'          => '6'
        ];  
  }
  elseif( !in_array($slug,$excluded_modules) && isset($form[$key]['sections'])  )
  {
    
    $form[$key][ 'sections' ]['bt_notes_section'] = [
      'title' => 'Notes',
      'fields' => [
        'bt_notes' => [
              'type'          => 'textarea',
              'label'         => 'Your Notes (Not displayed on website)',
              'placeholder'   => 'Notes',
              'rows'          => '6'
          ]
        ]
      ];
  }
    
  return $form;    
}
add_filter( 'fl_builder_register_settings_form', 'bt_register_notes', 100, 2 );

COMMENTS:

Leave a Comment





Level up your Beaver Builder skills

Over 2,000 Beaver Builders can't be wrong!

We've got a million ideas that we've implemented on over 100+ BB enabled websites.

Pop in your email below, and we'll let you know when a new post or plugin is available 🙂

Newsletter

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Spam sucks.