Adding notes to Beaver Builder modules
Author:
https://www.beaver.team
Description:
Add a comment to a module, column or row settings area.
For example, there is a gallery where the images need to be 300×300 to look right, so there will be no need to open the gallery to see the photo settings to find the size. Another example, there is a row that has a custom class, so you want to be able to call that out right from the General Tab.
Kind:
PHP, Beaver
PHP:
/* Add the notes field to all BB modules, rows, columns. Notes field found in the advanced tab.
* With love from https://beaver.team
*/
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 );