Skip to content

Instantly share code, notes, and snippets.

@carlosonweb
Last active July 31, 2019 21:46
Show Gist options
  • Save carlosonweb/55401042a77ce7a391dd43ee9213a83f to your computer and use it in GitHub Desktop.
Save carlosonweb/55401042a77ce7a391dd43ee9213a83f to your computer and use it in GitHub Desktop.
Sample Code to Customize Themer Connection Field
<?php
/**
*
* This is a stripped down code based on the sample in this doc:
*
* https://kb.wpbeaverbuilder.com/article/391-customize-field-connections-themer
*
*/
add_action( 'fl_page_data_add_properties', function() {
FLPageData::add_post_property( 'bbtest_my_connection', array(
'label' => 'My Connection',
'group' => 'general',
'type' => array( 'string', 'custom_field' ), // 'string',
'getter' => 'my_connection_getter',
'form' => 'bbtest_my_connection_form',
) );
} );
$my_form = array(
'sample_name' => array(
'type' => 'text',
'label' => __( 'Field Name', 'fl-theme-builder' ),
),
);
FLPageData::add_post_property_settings_fields( 'bbtest_my_connection_form', $my_form );
function my_connection_getter() {
return 'My text';
}
/**
* This one works, though.
*/
/*
add_action( 'fl_page_data_add_properties', function() {
FLPageData::add_post_property( 'my_connection', array(
'label' => 'My Connection',
'group' => 'general',
'type' => array('string'),
'getter' => 'my_connection_getter',
) );
FLPageData::add_post_property_settings_fields( 'my_connection', array(
'my_setting' => array(
'type' => 'text',
'label' => 'My Field Name',
))
);
} );
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment