There are several ways to customize field connections:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/beaverbuilder/documentation/llms.txt
Use this file to discover all available pages before exploring further.
- Add custom connections to the field connections menu
- Create a custom settings form for field connections
- Add a new group to organize field connections displayed in the connections menu
- Add support for field connections to your module fields
Add new connections
You can use the APIs to add custom connections to the field connections menu in order to connect any kind of data you want. There are three main methods for adding new connections:FLPageData::add_post_property( $key, $config )- Adds a connection related to postsFLPageData::add_archive_property( $key, $config )- Adds a connection related to archivesFLPageData::add_site_property( $key, $config )- Adds a connection related to the site
fl_page_data_add_properties action. Each method accepts a key for your connection and a config array.
The following code example shows the method FLPageData::add_post_property() used within the fl_page_data_add_properties action.
label (required)
The label for your connection that will show in the menu.group (required)
The group you want your connection to appear in. Currently, the following groups are built in (array key values in parentheses):- General (
general) - Archives (
archives) - Posts (
posts) - Comments (
comments) - Author (
author) - User (
user) - Site (
site) - Advanced (
advanced) - Advanced Custom Fields (
acf) - BigCommerce (
bigcommerce) - Easy Digital Downloads (
edd) - The Events Calendar (
the-events-calendar) - WooCommerce (
woocommerce)
type (required)
The type of connection. Use this when you connect a field to indicate what type of connections are available. For example, when you add a text field to a settings form, you can indicate that all of the string and HTML-based connections are available. You can set the type to anything you want. However, we recommend that you stick with the built-in connection types if you want your connections to appear in built-in modules. Currently, the following connection types are built in:- color
- string
- html
- photo
- multiple-photos
- url
- custom_field
getter (required)
A reference to a function or class method that is used to retrieve the data for your connection.Add a settings form
Creating custom forms for field connections is very similar to creating custom modules. There are three main methods for adding settings, the choice of which depends on the type of connection:FLPageData::add_post_property_settings_fields( $key, $config )- Adds settings to a post connectionFLPageData::add_archive_property_settings_fields( $key, $config )- Adds settings to a archive connectionFLPageData::add_site_property_settings_fields( $key, $config )- Adds settings to a site connection
css and js property for defining CSS and JavaScript files that should be loaded along with your settings.
Adding custom groups
You can add a group to the list of field connections. In the following screenshot, Posts, Author, and User are groups that organize the field connections.
To add a new group, use the FLPageData::add_group( $key, $config ) method, as shown in the following example:
Connect module fields
You can add support for field connections to your module fields by defining what kind of connections they should support. Use theconnections property in the field config. The following code example shows how you would add support for all connections registered as strings:
frontend.php file, you can access all of your settings on the $settings object, just as you normally would, whether they are connected or not. For example, if your setting key is text, you would still access it like this:
Add theme support
Most themes support Archive, Singular, and 404 layout types out of the box. However, to support the Header, Footer, and Part layout types, the theme must allow its header, footer, and parts to be removed using hooks.Add header and footer support
There are other ways than using hooks to remove the theme’s headers and footers, but using hooks is the easiest and cleanest. For example, in Genesis you can remove the header with the following code:after_setup_theme action in your functions.php file:
Add parts support
Theme parts are references to actions in your theme that a layout can be hooked into. For example, if your theme has abefore_header action, you can register that so Part layout types can be rendered there.
Adding support for part layout types is basically the same as adding support for headers and footers layout types. In fact, you can declare support for headers, footers, and parts at the same time:
fl_theme_builder_part_hooks filter to register your parts. The function for your filter should return an array of arrays for each group of parts, as shown below. Within the hooks array, set your actions to the array key, and set the human-readable label to the array value.
Here’s an example of what that would look like for Genesis: