To add a new option to Avada Dynamic Content Options, you can use fusion_set_dynamic_params filter in your child theme or plugin. This filter is useful for removing or adding options. Here is some sample code.
Copy to Clipboardfunction custom_dynamic_param( $params ) {
$params['param_id'] = [
'label' => esc_html__( 'Param Label', 'fusion-builder' ),
'id' => 'param_id',
'group' => esc_attr__( 'Param Group', 'fusion-builder' ),
'default' => 'Default Value'
'options' => [ 'textfield', 'textarea', 'tinymce', 'raw_textarea' ],
'callback' => [
'function' => 'get_custom_dynamic_param',
'ajax' => true,
],
];
return $params;
}
add_filter( 'fusion_set_dynamic_params', 'custom_dynamic_param' );
// Callback method to get dynamic option value.
function get_custom_dynamic_param( $args ) {
return 'Custom Param Value';
}x 1function custom_dynamic_param( $params ) {2 $params['param_id'] = [3 'label' => esc_html__( 'Param Label', 'fusion-builder' ),4 'id' => 'param_id',5 'group' => esc_attr__( 'Param Group', 'fusion-builder' ),6 'default' => 'Default Value'7 'options' => [ 'textfield', 'textarea', 'tinymce', 'raw_textarea' ],8 'callback' => [9 'function' => 'get_custom_dynamic_param',10 'ajax' => true,11 ],12 ];13 return $params;14}1516add_filter( 'fusion_set_dynamic_params', 'custom_dynamic_param' );1718// Callback method to get dynamic option value.19function get_custom_dynamic_param( $args ) {20 return 'Custom Param Value';21}Each option can have the following arguments.
label = Label which is displayed in options dropdown.id = Unique option ID.group = This is used to group similar content types.default = The default value of option.options = An array of Avada Builder input option names where this dynamic content can be used.callback = An array containing callback method name and bool ajax flagfields = Optional array of additional data fields.For a better understanding of the available options, please check the set_params function within fusion-builder/inc/class-fusion-dynamic-data.php