| @@ -53,16 +53,28 @@ | ||
| 53 | 53 | if ( empty( $this->documents ) ) { |
| 54 | 54 | return; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | + // Should load 'elementor-admin-bar' before 'admin-bar' | |
| 58 | + wp_dequeue_script( 'admin-bar' ); | |
| 59 | + | |
| 57 | 60 | wp_enqueue_script( |
| 58 | 61 | 'elementor-admin-bar', |
| 59 | - $this->get_js_assets_url( 'admin-bar' ), | |
| 62 | + $this->get_js_assets_url( 'elementor-admin-bar' ), | |
| 60 | 63 | [ 'elementor-frontend-modules' ], |
| 61 | 64 | ELEMENTOR_VERSION, |
| 62 | 65 | true |
| 63 | 66 | ); |
| 64 | 67 | |
| 68 | + // This is a core script of WordPress, it is not required to pass the 'ver' argument. | |
| 69 | + wp_enqueue_script( // phpcs:ignore WordPress.WP.EnqueuedResourceParameters | |
| 70 | + 'admin-bar', | |
| 71 | + null, | |
| 72 | + [ 'elementor-admin-bar' ], | |
| 73 | + false, | |
| 74 | + true | |
| 75 | + ); | |
| 76 | + | |
| 65 | 77 | $this->print_config( 'elementor-admin-bar' ); |
| 66 | 78 | } |
| 67 | 79 | |
| 68 | 80 | /** |
| @@ -120,8 +132,8 @@ | ||
| 120 | 132 | /** |
| 121 | 133 | * Module constructor. |
| 122 | 134 | */ |
| 123 | 135 | public function __construct() { |
| 124 | - add_action( 'elementor/frontend/get_builder_content', [ $this, 'add_document_to_admin_bar' ], 10, 2 ); | |
| 136 | + add_action( 'elementor/frontend/before_get_builder_content', [ $this, 'add_document_to_admin_bar' ], 10, 2 ); | |
| 125 | 137 | add_action( 'wp_footer', [ $this, 'enqueue_scripts' ], 11 /* after third party scripts */ ); |
| 126 | 138 | } |
| 127 | 139 | } |