Enqueue a script for my Avada Builder Element on back end

Enqueue a script for my Avada Builder Element on back end

When registering a new Avada Builder Element via fusion_builder_map() helper function provide admin_enqueue_js attribute with your script location.
Copy to Clipboardfunction fusion_element_text() {

fusion_builder_map(
array(
'name' => esc_attr__( 'Text Block', 'fusion-builder' ),
'shortcode' => 'fusion_text',
'admin_enqueue_js' =>'/js/my-script.js',
'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        'admin_enqueue_js' =>'/js/my-script.js',8        'params'          => array(9            array(10                'type'        => 'tinymce',11                'heading'     => esc_attr__( 'Content', 'fusion-builder' ),12                'description' => esc_attr__( 'Enter some content for this textblock.', 'fusion-builder' ),13                'param_name'  => 'element_content',14                'value'       => esc_attr__( 'Click edit button to change this text.', 'fusion-builder' ),15           ),16       ),17   ) 18);19}20add_action( 'fusion_builder_before_init', 'fusion_element_text' );

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注