PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.4
Elementor Website Builder – more than just a page builder v4.1.4
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 4.1.0-dev2 4.0.8 All 454 releases
← All changes | modules/global-classes/global-classes-repository.php +15 -3 4.3.0-beta3 → 4.1.4 View file →
@@ -2,9 +2,9 @@
2 2 namespace Elementor\Modules\GlobalClasses;
3 3
4 4 use Elementor\Core\Kits\Documents\Kit;
5 5 use Elementor\Modules\DesignSystemSync\Classes\Global_Classes_Sync_Map;
6 -use Elementor\Core\Kits\Concerns\Has_Kit_Dependency;
6 +use Elementor\Modules\GlobalClasses\Concerns\Has_Kit_Dependency;
7 7 use Elementor\Modules\GlobalClasses\Concerns\Has_Preview_Context;
8 8 use Elementor\Modules\GlobalClasses\Utils\Global_Class_Data_Normalizer;
9 9
10 10 if ( ! defined( 'ABSPATH' ) ) {
@@ -28,8 +28,12 @@
28 28 'event' => [
29 29 'frontend' => self::CONTEXT_FRONTEND,
30 30 'preview' => self::CONTEXT_PREVIEW,
31 31 ],
32 + 'meta_key' => [
33 + 'frontend' => self::META_KEY_FRONTEND,
34 + 'preview' => self::META_KEY_PREVIEW,
35 + ],
32 36 ];
33 37
34 38 private ?Global_Classes $cache = null;
35 39
@@ -83,8 +87,16 @@
83 87 }
84 88
85 89 $labels->set_labels( $existing_labels );
86 90
91 + if ( ! $this->is_preview() ) {
92 + Global_Classes_Order::make( $this->get_kit() )
93 + ->set_preview( true )
94 + ->set_order( $order );
95 +
96 + $this->clear_preview_labels_for_ids( array_keys( $new_labels ) );
97 + }
98 +
87 99 $this->cache = null;
88 100 }
89 101
90 102 private function labels(): Global_Classes_Labels {
@@ -91,9 +103,9 @@
91 103 return Global_Classes_Labels::make( $this->get_kit() )->set_preview( $this->is_preview() );
92 104 }
93 105
94 106 public function get( string $class_id ): ?array {
95 - $post = Global_Class_Post::find_by_class_id( $class_id, $this->is_preview(), $this->get_kit() );
107 + $post = Global_Class_Post::find_by_class_id( $class_id, $this->is_preview() );
96 108
97 109 return $post ? $post->to_array() : null;
98 110 }
99 111
@@ -430,9 +442,9 @@
430 442 public function delete_all(): void {
431 443 $order = $this->get_order();
432 444
433 445 $this->each_class_id_batch( $order, function ( string $class_id ) {
434 - $post = Global_Class_Post::find_by_class_id( $class_id, false, $this->get_kit() );
446 + $post = Global_Class_Post::find_by_class_id( $class_id );
435 447
436 448 if ( $post ) {
437 449 $post->delete();
438 450 }