fusion_builder_auto_activate_element()

fusion_builder_auto_activate_element()

Copy to Clipboardfusion_builder_auto_activate_element(string shortcode_tag) 1fusion_builder_auto_activate_element(string shortcode_tag)Activate Avada Builder element automatically on plugin activation. Avada Builder element becomes available in Avada Builder library and is automatically enabled on Avada Builder > Settings page.
Copy to Clipboardregister_activation_hook( __FILE__, 'auto_activate_element' );

function auto_activate_element() {
if ( function_exists( 'fusion_builder_auto_activate_element' ) ) {
fusion_builder_auto_activate_element( 'shortcode_tag' );
}
}​x 1register_activation_hook( __FILE__, 'auto_activate_element' );2​3function auto_activate_element() {4    if ( function_exists( 'fusion_builder_auto_activate_element' ) ) {5        fusion_builder_auto_activate_element( 'shortcode_tag' );6   }7}

fusion_builder_map()

fusion_builder_map()

Copy to Clipboardfusion_builder_map(array $atts) 1fusion_builder_map(array $atts)Add a registered shortcode as an element to the Avada Builder elements library.
Attributes$atts (array) (Required) – An array of element attributes which are used by Avada Builder to register new element.
name (string) Name of element that is displayed in libraryshortcode (string) Shortcode tagicon (string) Element icon that is displayed in librarymulti (boolean) Set to true for elements with nested structure. See: Add new multi (nested) elementpreview (string) Absolute url to element preview template filepreview_id (string) Element preview template IDhide_from_builder (boolean) Hide element from libraryallow_generator (boolean) Enable Avada Builder shortcode generator on this element』s Visual editor windowgenerator_only (boolean) Element can be added from Avada Builder generator onlyparams (array) Element settings. These settings are displayed on element settings windowadmin_enqueue_js (string) Absolute url to javascript file, this file is loaded with the element on WordPress backendadmin_enqueue_css (string) Absolute url to css file, this file is loaded with the element on WordPress backendfront_enqueue_js (string) Element javascript file. Absolute url to javascript file, this file is loaded with the element on frontendfront_enqueue_css (string) Element css file. Absolute url to css file, this file is loaded with the element on frontendon_save (string) Function name. Optional function that runs when saving element settings. Can be used to manipulate generated shortcode attributes contentcustom_settings_view_js (string) Custom element settings backbone view. Absolute url to javascript file, this file is loaded with the element on WordPress backendcustom_settings_view_name (string) Custom element settings view namecustom_settings_template_file (string) Custom element settings template that will be loaded instead of default one. Absolute url to template fileadd_edit_items (string) Sets a custom title/heading of the parent/child sortable area. If this is not used, it defaults to 「Add/Edit Items」sortable_items_info (string) Sets a custom description (the paragraph part under the heading) for the parent/child sortable area. If this is not used, it defaults to 「Add or edit new items for this element. Drag and drop them into the desired order.」ParametersAn associative array of element settings that are displayed on element settings window. Each param_name must match shortcode attribute name.
type (string) Element setting type that is used on element settings page. See: Available setting typesheading (string) Element setting name that is displayed on element settings pagedescription (string) Element setting description text that is displayed on element settings pageparam_name (string) Parameter name. Must match shortcode attribute name. Use element_content as param name for shortcode enclosed contentvalue (string | integer | bloolean | array ) Default setting valuegroup (string) Setting group for this settingmin (string | float | integer ) Minimum setting value. Used for range setting type onlymax (string | float | integer ) Maximum setting value. Used for range setting type onlystep (string | float | integer ) Setting range step. Used for range setting type onlyCopy to Clipboardfunction fusion_element_text() {

fusion_builder_map(
array(
'name' => esc_attr__( 'Text Block', 'fusion-builder' ),
'shortcode' => 'fusion_text',
'icon' => 'fusiona-font',
'preview' => PLUGIN_DIR . 'js/previews/fusion-text-preview.php',
'preview_id' => 'fusion-builder-block-module-text-preview-template',
'allow_generator' => true,
'add_edit_items' => 'Add Content Box',
'sortable_items_info' => 'Some custom intro added here.',
'params' => array(
array(
'type' => 'tinymce',
'heading' => esc_attr__( 'Content', 'fusion-builder' ),
'description' => esc_attr__( 'Enter some content for this textblock.', 'fusion-builder' ),
'param_name' => 'element_content',
'value' => esc_attr__( 'Click edit button to change this text.', 'fusion-builder' ),
),
),
)
);
}
add_action( 'fusion_builder_before_init', 'fusion_element_text' );​x 1function fusion_element_text() {2​3fusion_builder_map( 4    array(5        'name'            => esc_attr__( 'Text Block', 'fusion-builder' ),6        'shortcode'       => 'fusion_text',7        'icon'            => 'fusiona-font',8        'preview'         => PLUGIN_DIR . 'js/previews/fusion-text-preview.php',9        'preview_id'      => 'fusion-builder-block-module-text-preview-template',10        'allow_generator' => true,11        'add_edit_items'  => 'Add Content Box',12        'sortable_items_info' => 'Some custom intro added here.',13        'params'          => array(14            array(15                'type'        => 'tinymce',16                'heading'     => esc_attr__( 'Content', 'fusion-builder' ),17                'description' => esc_attr__( 'Enter some content for this textblock.', 'fusion-builder' ),18                'param_name'  => 'element_content',19                'value'       => esc_attr__( 'Click edit button to change this text.', 'fusion-builder' ),20           ),21       ),22   ) 23);24}25add_action( 'fusion_builder_before_init', 'fusion_element_text' );

fusion_builder_shortcodes_categories()

fusion_builder_shortcodes_categories()

Copy to Clipboardfusion_builder_shortcodes_categories( string $taxonomy, bool $empty_choice, string $empty_choice_label ) 1fusion_builder_shortcodes_categories( string $taxonomy, bool $empty_choice, string $empty_choice_label )Retrieve a list of category objects for defined taxonomy. Display a category list as element option.
Params$taxonomy
(string) (Required) Taxonomy to retrieve terms for.
$empty_choice
(bool) Add empty option to a returned category list. Default: false.
$empty_choice_label
(string) Text label for empty option in a returned category list. Default: 「Default」.Copy to Clipboardfusion_builder_map(
array(
'name' => esc_attr__( 'Fusion Builder Element', 'fusion-builder' ),
'shortcode' => 'fusion_text',
'icon' => 'fusiona-font',
'preview' => PLUGIN_DIR . 'js/previews/fusion-text-preview.php',
'preview_id' => 'fusion-builder-block-module-text-preview-template',
'allow_generator' => true,
'params' => array(
array(
'type' => 'select',
'heading' => esc_attr__( 'Category', 'fusion-builder' ),
'description' => esc_attr__( 'Select a category of posts to display.', 'fusion-builder' ),
'param_name' => 'category',
'value' => fusion_builder_shortcodes_categories( 'category', true, esc_attr__( 'All', 'fusion-builder' ) ),
'default' => '',

),
),
)
);xxxxxxxxxx21 1fusion_builder_map( 2    array(3        'name'            => esc_attr__( 'Fusion Builder Element', 'fusion-builder' ),4        'shortcode'       => 'fusion_text',5        'icon'            => 'fusiona-font',6        'preview'         => PLUGIN_DIR . 'js/previews/fusion-text-preview.php',7        'preview_id'      => 'fusion-builder-block-module-text-preview-template',8        'allow_generator' => true,9        'params'          => array(10            array(11                'type'        => 'select',12                'heading'     => esc_attr__( 'Category', 'fusion-builder' ),13                'description' => esc_attr__( 'Select a category of posts to display.', 'fusion-builder' ),14                'param_name'  => 'category',15                'value'       => fusion_builder_shortcodes_categories( 'category', true, esc_attr__( 'All', 'fusion-builder' ) ),16                'default'     => '',17 18             ),19       ),20   ) 21);

fusion_builder_update_element()

fusion_builder_update_element()

If you want to update any existing element setting options, you can simply use this function and the values will get appended to the existing settings for that element.
The functionCopy to Clipboardfusion_builder_update_element( $shortcode_tag, $param_name, $values_to_append ); 1fusion_builder_update_element( $shortcode_tag, $param_name, $values_to_append );Basic usageCopy to Clipboardfunction update_element_options() {

// Example of how to add or modify options to existing element in Fusion Builder.

if ( function_exists( 'fusion_builder_update_element' ) ) {

fusion_builder_update_element( 'fusion_button', 'color', array( 'cyan' => esc_attr__( 'New - Cyan', 'fusion-builder' ) ) );

fusion_builder_update_element( 'fusion_button', 'color', array( 'black' => esc_attr__( 'New - Black', 'fusion-builder' ) ) );

fusion_builder_update_element( 'fusion_button', 'element_content', 'Sample Button' );

}

}

add_action( 'fusion_builder_before_init', 'update_element_options', 11 );​x 1function update_element_options() {2​3  // Example of how to add or modify options to existing element in Fusion Builder.4​5  if ( function_exists( 'fusion_builder_update_element' ) ) {6​7    fusion_builder_update_element( 'fusion_button', 'color', array( 'cyan' => esc_attr__( 'New - Cyan', 'fusion-builder' ) ) );8​9    fusion_builder_update_element( 'fusion_button', 'color', array( 'black' => esc_attr__( 'New - Black', 'fusion-builder' ) ) );10​11    fusion_builder_update_element( 'fusion_button', 'element_content', 'Sample Button' );12​13 }14​15}16​17add_action( 'fusion_builder_before_init', 'update_element_options', 11 );The above example will add the color option 「Black」 and 「Cyan」 in the colors dropdown for the button element. Which will output the color class name as 「fusion-black」 and 「fusion-cyan」, which you can use to customize the color for your button.
This is a rather simple solution if you want to use the custom color combination buttons on your site.
Function Parameters$shortcode_tag
( string ) Registered shortcode name in Avada Builder.$param_name
( string ) Param name to be altered. Check shortcode to get the param name.$values_to_append
( array | string ) Value to be set as default or append to the existing array.