| @@ -38,14 +38,14 @@ | ||
| 38 | 38 | */ |
| 39 | 39 | public function register_elementor_rest_field() { |
| 40 | 40 | register_rest_field( get_post_types( '', 'names' ), |
| 41 | 41 | 'gutenberg_elementor_mode', [ |
| 42 | - 'update_callback' => function( $request_value, $obj ) { | |
| 43 | - if ( ! User::is_current_user_can_edit( $obj->ID ) ) { | |
| 42 | + 'update_callback' => function( $request_value, $object ) { | |
| 43 | + if ( ! User::is_current_user_can_edit( $object->ID ) ) { | |
| 44 | 44 | return false; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - $document = Plugin::$instance->documents->get( $obj->ID ); | |
| 47 | + $document = Plugin::$instance->documents->get( $object->ID ); | |
| 48 | 48 | |
| 49 | 49 | if ( ! $document ) { |
| 50 | 50 | return false; |
| 51 | 51 | } |
| @@ -70,9 +70,9 @@ | ||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $this->is_gutenberg_editor_active = true; |
| 73 | 73 | |
| 74 | - $suffix = Utils::is_script_debug() ? '' : '.min'; | |
| 74 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 75 | 75 | |
| 76 | 76 | wp_enqueue_script( 'elementor-gutenberg', ELEMENTOR_ASSETS_URL . 'js/gutenberg' . $suffix . '.js', [ 'jquery' ], ELEMENTOR_VERSION, true ); |
| 77 | 77 | |
| 78 | 78 | $elementor_settings = [ |
| @@ -94,12 +94,9 @@ | ||
| 94 | 94 | ?> |
| 95 | 95 | <script id="elementor-gutenberg-button-switch-mode" type="text/html"> |
| 96 | 96 | <div id="elementor-switch-mode"> |
| 97 | 97 | <button id="elementor-switch-mode-button" type="button" class="button button-primary button-large"> |
| 98 | - <span class="elementor-switch-mode-on"> | |
| 99 | - <i class="eicon-wordpress" aria-hidden="true"></i> | |
| 100 | - <?php echo esc_html__( 'Edit with WordPress', 'elementor' ); ?> | |
| 101 | - </span> | |
| 98 | + <span class="elementor-switch-mode-on"><?php echo esc_html__( '← Back to WordPress Editor', 'elementor' ); ?></span> | |
| 102 | 99 | <span class="elementor-switch-mode-off"> |
| 103 | 100 | <i class="eicon-elementor-square" aria-hidden="true"></i> |
| 104 | 101 | <?php echo esc_html__( 'Edit with Elementor', 'elementor' ); ?> |
| 105 | 102 | </span> |
| @@ -127,19 +124,8 @@ | ||
| 127 | 124 | </div> |
| 128 | 125 | </div> |
| 129 | 126 | </div> |
| 130 | 127 | </script> |
| 131 | - | |
| 132 | - <script id="elementor-gutenberg-button-tmpl" type="text/html"> | |
| 133 | - <div id="elementor-edit-button-gutenberg"> | |
| 134 | - <button id="elementor-edit-mode-button" type="button" class="button button-primary button-large"> | |
| 135 | - <span class="elementor-edit-mode-gutenberg"> | |
| 136 | - <i class="eicon-elementor-square" aria-hidden="true"></i> | |
| 137 | - <?php echo esc_html__( 'Edit with Elementor', 'elementor' ); ?> | |
| 138 | - </span> | |
| 139 | - </button> | |
| 140 | - </div> | |
| 141 | - </script> | |
| 142 | 128 | <?php |
| 143 | 129 | } |
| 144 | 130 | |
| 145 | 131 | /** |
| @@ -176,13 +162,13 @@ | ||
| 176 | 162 | * |
| 177 | 163 | * @since 3.21.0 |
| 178 | 164 | * @access private |
| 179 | 165 | */ |
| 180 | - private static function is_optimized_gutenberg_loading_enabled(): bool { | |
| 166 | + private static function is_optimized_gutenberg_loading_enabled() : bool { | |
| 181 | 167 | return (bool) get_option( 'elementor_optimized_gutenberg_loading', '1' ); |
| 182 | 168 | } |
| 183 | 169 | |
| 184 | - private static function should_dequeue_gutenberg_assets(): bool { | |
| 170 | + private static function should_dequeue_gutenberg_assets() : bool { | |
| 185 | 171 | $post = get_post(); |
| 186 | 172 | |
| 187 | 173 | if ( empty( $post->ID ) ) { |
| 188 | 174 | return false; |
| @@ -198,9 +184,9 @@ | ||
| 198 | 184 | |
| 199 | 185 | return true; |
| 200 | 186 | } |
| 201 | 187 | |
| 202 | - private static function is_built_with_elementor( $post ): bool { | |
| 188 | + private static function is_built_with_elementor( $post ) : bool { | |
| 203 | 189 | $document = Plugin::$instance->documents->get( $post->ID ); |
| 204 | 190 | |
| 205 | 191 | if ( ! $document || ! $document->is_built_with_elementor() ) { |
| 206 | 192 | return false; |
| @@ -208,9 +194,9 @@ | ||
| 208 | 194 | |
| 209 | 195 | return true; |
| 210 | 196 | } |
| 211 | 197 | |
| 212 | - private static function is_gutenberg_in_post( $post ): bool { | |
| 198 | + private static function is_gutenberg_in_post( $post ) : bool { | |
| 213 | 199 | if ( has_blocks( $post ) ) { |
| 214 | 200 | return true; |
| 215 | 201 | } |
| 216 | 202 | |
| @@ -220,9 +206,9 @@ | ||
| 220 | 206 | |
| 221 | 207 | return false; |
| 222 | 208 | } |
| 223 | 209 | |
| 224 | - private static function current_theme_is_fse_theme(): bool { | |
| 210 | + private static function current_theme_is_fse_theme() : bool { | |
| 225 | 211 | if ( function_exists( 'wp_is_block_theme' ) ) { |
| 226 | 212 | return (bool) wp_is_block_theme(); |
| 227 | 213 | } |
| 228 | 214 | if ( function_exists( 'gutenberg_is_fse_theme' ) ) { |