Hi, community! I hope that you can help me. I’m trying to create my own button module, but every time when i click “save” button i get following JavaScript erorr:
Beaver Builder caught the following JavaScript error. If Beaver Builder is not functioning as expected the cause is most likely this error. Please help us by disabling all plugins and testing Beaver Builder while reactivating each to determine if the issue is related to a third party plugin.
“Error: Permission denied to access property “apply”” on line 3 of [fl-builder.min.js:6:8816]
really i do not understand why this happens, but when i remove “Title” field from my “attributes” section, error disappears.
Is it a bug, how to avoid this? I have really simple configuration, but can not make this work, please help!
Console error: Screenshot by Lightshot
My code:
<?php
class MyTestButton extends \FLBuilderModule {
public function __construct() {
parent::__construct( [
'name' => __( 'Liquid Button', 'myblock'),
'description' => __( 'A button with liquid hover effect', 'myblock'),
'category' => __( 'Buttons', 'myblock'),
'group' => __( 'My group', 'myblock'),
'dir' => plugin_dir_path( __FILE__ ),
'url' => plugin_dir_url( __FILE__ ),
'editor_export' => true,
'enabled' => true,
'partial_refresh' => true
]);
$this->add_css( 'mytest-button');
$this->add_js( 'mytest-button');
}
}
FLBuilder::register_module( 'MyTestButton', [
'general' => [
'title' => esc_html__( 'General', 'myblock' ),
'sections' => [
'attributes' => [
'title' => esc_html__( 'Attributes', 'myblock' ),
'fields' => [
'title' => [
'type' => 'text',
'label' => esc_html__( 'Button title', 'myblock' ),
'default' => esc_html__( 'Click me!', 'myblock' ),
],
'address' => [
'type' => 'text',
'label' => esc_html__( 'Link URL', 'myblock' ),
'default' => '',
],
'target' => [
'type' => 'select',
'default' => '_self',
'label' => esc_html__( 'Target', 'myblock' ),
'options' => [
'_self' => esc_html__( 'Current window', 'myblock' ),
'_blank' => esc_html__( 'New window', 'myblock' ),
],
],
'align' => [
'type' => 'select',
'default' => 'left',
'label' => esc_html__( 'Button align', 'myblock' ),
'options' => [
'left' => esc_html__( 'Left', 'myblock' ),
'center' => esc_html__( 'Center', 'myblock' ),
'right' => esc_html__( 'Right', 'myblock' ),
],
],
]
],
'size' => [
'title' => esc_html__( 'Size', 'myblock' ),
'fields' => [
'width' => [
'type' => 'text',
'label' => esc_html__( 'Width', 'myblock' ),
'default' => 200,
],
'height' => [
'type' => 'text',
'label' => esc_html__( 'Height', 'myblock' ),
'default' => 75,
],
]
],
'style' => [
'title' => esc_html__( 'Style', 'myblock' ),
'fields' => [
'accent' => [
'type' => 'select',
'default' => 'alpha',
'label' => esc_html__( 'Accent color', 'myblock' ),
'options' => [
'alpha' => esc_html__( 'Alpha', 'myblock' ),
'beta' => esc_html__( 'Beta', 'myblock' ),
'gamma' => esc_html__( 'Gamma', 'myblock' ),
'delta' => esc_html__( 'Delta', 'myblock' ),
],
],
]
],
]
]
]);
?>