PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.0-beta1
Elementor Website Builder – more than just a page builder v4.1.0-beta1
4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 All 456 releases
← All changes | modules/global-classes/global-classes-repository.php +15 -3 4.1.0-beta3 → 4.1.0-beta1 View file →
@@ -4,9 +4,8 @@
4 4 use Elementor\Core\Kits\Documents\Kit;
5 5 use Elementor\Modules\DesignSystemSync\Classes\Global_Classes_Sync_Map;
6 6 use Elementor\Modules\GlobalClasses\Concerns\Has_Kit_Dependency;
7 7 use Elementor\Modules\GlobalClasses\Concerns\Has_Preview_Context;
8 -use Elementor\Modules\GlobalClasses\Utils\Global_Class_Data_Normalizer;
9 8
10 9 if ( ! defined( 'ABSPATH' ) ) {
11 10 exit; // Exit if accessed directly.
12 11 }
@@ -323,9 +322,9 @@
323 322 return;
324 323 }
325 324
326 325 $item = $items_by_id[ $class_id ];
327 - $data = Global_Class_Data_Normalizer::normalize_style_fields( $item );
326 + $data = $this->build_class_data_for_storage( $item );
328 327
329 328 if ( $is_preview ) {
330 329 $post = Global_Class_Post::find_by_class_id( $class_id, true );
331 330
@@ -359,9 +358,9 @@
359 358 if ( ! $post ) {
360 359 return;
361 360 }
362 361
363 - $data = Global_Class_Data_Normalizer::normalize_style_fields( $item );
362 + $data = $this->build_class_data_for_storage( $item );
364 363 $post->update_data( $data );
365 364 $post->update_label( $item['label'] );
366 365 clean_post_cache( $post->get_post_id() );
367 366 } );
@@ -395,6 +394,19 @@
395 394 private function flush_runtime_cache(): void {
396 395 if ( function_exists( 'wp_cache_flush_runtime' ) ) {
397 396 wp_cache_flush_runtime();
398 397 }
398 + }
399 +
400 + private function build_class_data_for_storage( array $item ): array {
401 + $data = [
402 + 'type' => $item['type'] ?? 'class',
403 + 'variants' => $item['variants'] ?? [],
404 + ];
405 +
406 + if ( array_key_exists( 'sync_to_v3', $item ) ) {
407 + $data['sync_to_v3'] = (bool) $item['sync_to_v3'];
408 + }
409 +
410 + return $data;
399 411 }
400 412 }