← All changes
|
modules/variables/storage/variables-repository.php
+4
-2
4.2.1
→
3.35.0-dev2
View file →
| @@ -5,8 +5,10 @@ | ||
| 5 | 5 | use Elementor\Core\Kits\Documents\Kit; |
| 6 | 6 | use Elementor\Modules\Variables\Adapters\Prop_Type_Adapter; |
| 7 | 7 | |
| 8 | 8 | class Variables_Repository { |
| 9 | + private const VARIABLES_META_KEY = '_elementor_global_variables'; | |
| 10 | + | |
| 9 | 11 | private Kit $kit; |
| 10 | 12 | |
| 11 | 13 | public function __construct( Kit $kit ) { |
| 12 | 14 | $this->kit = $kit; |
| @@ -12,9 +14,9 @@ | ||
| 12 | 14 | $this->kit = $kit; |
| 13 | 15 | } |
| 14 | 16 | |
| 15 | 17 | public function load(): Variables_Collection { |
| 16 | - $db_record = $this->kit->get_json_meta( Constants::VARIABLES_META_KEY ); | |
| 18 | + $db_record = $this->kit->get_json_meta( self::VARIABLES_META_KEY ); | |
| 17 | 19 | |
| 18 | 20 | if ( is_array( $db_record ) && ! empty( $db_record ) ) { |
| 19 | 21 | $collection = Variables_Collection::hydrate( $db_record ); |
| 20 | 22 | |
| @@ -30,9 +32,9 @@ | ||
| 30 | 32 | $collection->increment_watermark(); |
| 31 | 33 | |
| 32 | 34 | $record = Prop_Type_Adapter::to_storage( $collection ); |
| 33 | 35 | |
| 34 | - if ( $this->kit->update_json_meta( Constants::VARIABLES_META_KEY, $record ) ) { | |
| 36 | + if ( $this->kit->update_json_meta( static::VARIABLES_META_KEY, $record ) ) { | |
| 35 | 37 | return $collection->watermark(); |
| 36 | 38 | } |
| 37 | 39 | |
| 38 | 40 | return false; |