JavaScript Error while using Elementor Plugin
Version
- Carbon Fields: 2.1
- WordPress: 4.9.5
- PHP: 7.2.0
- Elementor: 2.0.8
Expected Behavior
No JavaScript Error while working with Elementor Plugin.
Actual Behavior
JavaScript Error appears in console.
Error
carbon.vendor.min.js?ver=2.1.1:49 uncaught at s
at r
at o
at a
Error: Could not find the metabox for container "carbon_fields_container_main_slider".
at http://nw.local/wp-content/themes/nw-theme/vendor/htmlburger/carbon-fields/assets/dist/carbon.core.min.js?ver=2.1.1:1:2216
at r (http://nw.local/wp-content/themes/nw-theme/vendor/htmlburger/carbon-fields/assets/dist/carbon.core.min.js?ver=2.1.1:7:26622)
at Generator._invoke (http://nw.local/wp-content/themes/nw-theme/vendor/htmlburger/carbon-fields/assets/dist/carbon.core.min.js?ver=2.1.1:7:27667)
at Generator.e.(anonymous function) [as next] (http://nw.local/wp-content/themes/nw-theme/vendor/htmlburger/carbon-fields/assets/dist/carbon.core.min.js?ver=2.1.1:7:26801)
at h (http://nw.local/wp-content/themes/nw-theme/vendor/htmlburger/carbon-fields/assets/dist/carbon.vendor.min.js?ver=2.1.1:15:26167)
at n (http://nw.local/wp-content/themes/nw-theme/vendor/htmlburger/carbon-fields/assets/dist/carbon.vendor.min.js?ver=2.1.1:15:26861)
at O (http://nw.local/wp-content/themes/nw-theme/vendor/htmlburger/carbon-fields/assets/dist/carbon.vendor.min.js?ver=2.1.1:15:28621)
at x (http://nw.local/wp-content/themes/nw-theme/vendor/htmlburger/carbon-fields/assets/dist/carbon.vendor.min.js?ver=2.1.1:15:27466)
at h (http://nw.local/wp-content/themes/nw-theme/vendor/htmlburger/carbon-fields/assets/dist/carbon.vendor.min.js?ver=2.1.1:15:26230)
at n (http://nw.local/wp-content/themes/nw-theme/vendor/htmlburger/carbon-fields/assets/dist/carbon.vendor.min.js?ver=2.1.1:15:26861)
p @ carbon.vendor.min.js?ver=2.1.1:49
m @ carbon.vendor.min.js?ver=2.1.1:15
r @ carbon.vendor.min.js?ver=2.1.1:15
e.cont @ carbon.vendor.min.js?ver=2.1.1:15
m @ carbon.vendor.min.js?ver=2.1.1:15
r @ carbon.vendor.min.js?ver=2.1.1:15
k @ carbon.vendor.min.js?ver=2.1.1:15
x @ carbon.vendor.min.js?ver=2.1.1:15
h @ carbon.vendor.min.js?ver=2.1.1:15
n @ carbon.vendor.min.js?ver=2.1.1:15
a @ carbon.vendor.min.js?ver=2.1.1:15
t @ carbon.vendor.min.js?ver=2.1.1:49
(anonymous) @ carbon.vendor.min.js?ver=2.1.1:49
(anonymous) @ carbon.vendor.min.js?ver=2.1.1:49
t @ carbon.vendor.min.js?ver=2.1.1:49
(anonymous) @ carbon.vendor.min.js?ver=2.1.1:49
dispatch @ carbon.vendor.min.js?ver=2.1.1:49
(anonymous) @ carbon.vendor.min.js?ver=2.1.1:49
(anonymous) @ carbon.vendor.min.js?ver=2.1.1:15
r @ carbon.vendor.min.js?ver=2.1.1:1
u @ carbon.vendor.min.js?ver=2.1.1:1
o @ carbon.vendor.min.js?ver=2.1.1:1
(anonymous) @ carbon.vendor.min.js?ver=2.1.1:49
t @ carbon.vendor.min.js?ver=2.1.1:49
(anonymous) @ carbon.vendor.min.js?ver=2.1.1:49
n.default @ carbon.boot.min.js?ver=2.1.1:1
(anonymous) @ post.php?post=52&action=elementor:7194
Container definition
use Carbon_Fields\Container as Carbon;
Carbon::make( 'post_meta', __( 'Main Slider', 'nw' ) )
->where( 'post_type', '=', 'page' )
->where( 'post_template', '=', 'front-page.php' )
->add_fields( array(
Field::make( 'complex', 'nw_top_slides', 'Slides')
->set_layout( 'tabbed-horizontal' )
->add_fields( array(
Field::make( 'text', 'nw_slide_caption', 'Caption'),
Field::make( 'image', 'nw_slide_image', 'Image')->set_help_text('Must be at least 1600x600 size' ),
))
) );
Steps to Reproduce the Problem
- Install Elementor and go to Edit Page with Elementor.
- Open console and there is Error.
Comments
I have applied Carbon Field to one Page template, it works perfectly in normal mode. When I try to edit other pages with Elementor plugin, I see carbon field throwing error. I have not noticed any conflict with Elementor working as of yet however this big red error is annoying in console and I would like a way to fix it.
Any help is appreciated.
Thanks
Hi @muazzami ,
The Elementor plugin modifies the whole DOM of the edit screen and the Carbon Fields can't be rendered on the modified screen. I believe this is an expected behavior because you are trying to register a field for a page/post where you can't use it.
Thank you for the response @deqngeorgiev
It hasn't cause any conflict as of yet and I hope there won't be one in future too. However wouldn't it be nice to have something like If no metabox don't initiate the container.. just an idea.