beaverbuilder
6/10/2018 - 6:02 PM

Customize field connections (Themer)

This snippet is used in the following knowledge base article – https://kb.wpbeaverbuilder.com/article/391-customize-field-connections-themer

<?php // do not copy this line, start with line 3

'text' => array(
	'type'          => 'text',
	'label'         => 'My Text Field',
	'connections'   => array( 'string', 'html', 'url' )
)
<?php // do not copy this line, start with line 3

'text' => array(
	'type'          => 'text',
	'label'         => 'My Text Field',
	'connections'   => array( 'string' )
)
<?php // do not copy this line, start with line 3

FLPageData::add_group('my_group', array(
    'label' => 'My Group'
));
<?php // do not copy this line, start with line 3

FLPageData::add_post_property_settings_fields('my_connection_form', array(
    'css'    => 'http://www.mysite.com/path-to-settings.css',
    'js'     => 'http://www.mysite.com/path-to-settings.js',
    'my_setting' => array(
        'type'          => 'text',
        'label'         => 'My Setting'
    )
));
<?php // do not copy this line, start with line 3

add_action('fl_page_data_add_properties', function () {
    FLPageData::add_post_property('my_connection', array(
        'label'   => 'My Connection',
        'group'   => 'general',
        'type'    => 'string',
        'getter'  => 'my_connection_getter',
                'form'    => 'my_connection_form'
    ));
});

function my_connection_getter()
{
    return 'My text';
}