Adding 3rd Party Fieldtypes

Estimated reading: 2 minutes

There are some amazing 3rd party fieldtypes out there, but the way they store the information isn’t always as obvious as you might think to Beaver Builder.

Toolbox needs to be aware of the different fieldtypes to be able to group them. 3rd Party Fieldtypes need to be added to the selectbox-list in order for them to appear.

You can do that by adding a few lines of PHP to your theme’s functions.php:

<?php

add_filter( 'toolbox_condlogic_fieldtypes' , 'foo123_add_custom_fieldtype' , 10, 1 );

function foo123_add_custom_fieldtype( $fieldtypes ) {
    return array_merge( $fieldtypes , 
                        array( 
                            array( 
                                'name' => 'image_aspect_ratio_crop',
                                'label'=> 'Aspect Crop'
                            ) ,
                        )  
                    );
}

The ‘name’ variable is the name of the fieldtype that you’ve installed. There are a few ways to determine the name, for instance:

  • You can find it in the plugin code, where it extends the acf_field class. The value for $this->name is the fieldtype-name.
  • When you’ve added the fieldtype as a custom field to your post, it will show up so you can enter a value. By examining the page’s code with your browser’s inspector, you can find the data-type property on the container. This is the fieldtype-name.

Logical Operators

By default you will have access to all logical operators that Beaver Builder provides. Logical operators are the checks that you can do, like “equals”, “does not equal”, “is empty”, “between”, “not between”. Because the number of available options can be pretty overwhelming, you can also set the available operators per fieldtype.

More on that here.

Share this Doc

Adding 3rd Party Fieldtypes

Or copy link

CONTENTS