PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.3
Elementor Website Builder – more than just a page builder v4.0.3
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 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / variables / storage / variables-repository.php

variables-repository.php in Elementor Website Builder – more than just a page builder 4.0.3, at modules/variables/storage/variables-repository.php

41 lines 946 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\Variables\Storage;
4
5 use Elementor\Core\Kits\Documents\Kit;
6 use Elementor\Modules\Variables\Adapters\Prop_Type_Adapter;
7
8 class Variables_Repository {
9 private Kit $kit;
10
11 public function __construct( Kit $kit ) {
12 $this->kit = $kit;
13 }
14
15 public function load(): Variables_Collection {
16 $db_record = $this->kit->get_json_meta( Constants::VARIABLES_META_KEY );
17
18 if ( is_array( $db_record ) && ! empty( $db_record ) ) {
19 $collection = Variables_Collection::hydrate( $db_record );
20
21 Prop_Type_Adapter::from_storage( $collection );
22
23 return $collection;
24 }
25
26 return Variables_Collection::default();
27 }
28
29 public function save( Variables_Collection $collection ) {
30 $collection->increment_watermark();
31
32 $record = Prop_Type_Adapter::to_storage( $collection );
33
34 if ( $this->kit->update_json_meta( Constants::VARIABLES_META_KEY, $record ) ) {
35 return $collection->watermark();
36 }
37
38 return false;
39 }
40 }
41