← All changes
|
modules/global-classes/global-classes-repository.php
+4
-14
4.0.9
→
4.0.0-beta1
View file →
| @@ -1,10 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Modules\GlobalClasses; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Kits\Documents\Kit; | |
| 5 | 4 | use Elementor\Modules\AtomicWidgets\PropTypeMigrations\Migrations_Orchestrator; |
| 6 | -use Elementor\Modules\GlobalClasses\Global_Classes_Parser; | |
| 7 | 5 | use Elementor\Plugin; |
| 8 | 6 | |
| 9 | 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | 8 | exit; // Exit if accessed directly. |
| @@ -21,18 +19,12 @@ | ||
| 21 | 19 | private string $context = self::CONTEXT_FRONTEND; |
| 22 | 20 | |
| 23 | 21 | private ?Global_Classes $cache = null; |
| 24 | 22 | |
| 25 | - private ?Kit $kit = null; | |
| 26 | - | |
| 27 | - public function __construct( ?Kit $kit = null ) { | |
| 28 | - $this->kit = $kit; | |
| 23 | + public static function make(): Global_Classes_Repository { | |
| 24 | + return new self(); | |
| 29 | 25 | } |
| 30 | 26 | |
| 31 | - public static function make( ?Kit $kit = null ): Global_Classes_Repository { | |
| 32 | - return new self( $kit ); | |
| 33 | - } | |
| 34 | - | |
| 35 | 27 | public function context( string $context ): self { |
| 36 | 28 | $this->context = $context; |
| 37 | 29 | $this->cache = null; |
| 38 | 30 | |
| @@ -54,10 +46,8 @@ | ||
| 54 | 46 | if ( $is_preview && $is_empty ) { |
| 55 | 47 | $all = $kit->get_json_meta( static::META_KEY_FRONTEND ); |
| 56 | 48 | } |
| 57 | 49 | |
| 58 | - $all['order'] = Global_Classes_Parser::sanitize_order( $all['items'] ?? [], $all['order'] ?? [] ); | |
| 59 | - | |
| 60 | 50 | Migrations_Orchestrator::make()->migrate( |
| 61 | 51 | $all, |
| 62 | 52 | $kit->get_id(), |
| 63 | 53 | $meta_key, |
| @@ -107,8 +97,8 @@ | ||
| 107 | 97 | ? static::META_KEY_FRONTEND |
| 108 | 98 | : static::META_KEY_PREVIEW; |
| 109 | 99 | } |
| 110 | 100 | |
| 111 | - private function get_kit(): Kit { | |
| 112 | - return $this->kit ?? Plugin::$instance->kits_manager->get_active_kit(); | |
| 101 | + private function get_kit() { | |
| 102 | + return Plugin::$instance->kits_manager->get_active_kit(); | |
| 113 | 103 | } |
| 114 | 104 | } |