PluginProbe
Elementor Website Builder – more than just a page builder / 3.34.3
Elementor Website Builder – more than just a page builder v3.34.3
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 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | modules/variables/services/variables-service.php +3 -18 4.1.23.34.3 View file →
@@ -7,10 +7,8 @@
7 7 use Elementor\Modules\Variables\Storage\Entities\Variable;
8 8 use Elementor\Modules\Variables\Storage\Exceptions\BatchOperationFailed;
9 9 use Elementor\Modules\Variables\Storage\Variables_Repository;
10 10 use Elementor\Modules\Variables\Storage\Exceptions\FatalError;
11 -use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type;
12 -use Elementor\Utils as ElementorUtils;
13 11
14 12 class Variables_Service {
15 13 private Variables_Repository $repo;
16 14 private Batch_Processor $batch_processor;
@@ -24,15 +22,9 @@
24 22 return $this->load()['data'];
25 23 }
26 24
27 25 public function load() {
28 - $collection = $this->repo->load()->serialize( true );
29 - foreach ( $collection['data'] as $id => $variable ) {
30 - if ( ! ElementorUtils::has_pro() && Size_Variable_Prop_Type::get_key() === $variable['type'] ) {
31 - unset( $collection['data'][ $id ] );
32 - }
33 - }
34 - return $collection;
26 + return $this->repo->load()->serialize( true );
35 27 }
36 28
37 29 /**
38 30 * @throws BatchOperationFailed Thrown when one of the operations fails.
@@ -93,9 +85,8 @@
93 85 $data['order'] = $collection->get_next_order();
94 86 }
95 87
96 88 $variable = Variable::from_array( $data );
97 - $variable->validate();
98 89
99 90 $collection->add_variable( $variable );
100 91
101 92 $watermark = $this->repo->save( $collection );
@@ -121,9 +112,8 @@
121 112 $collection->assert_label_is_unique( $data['label'], $id );
122 113 }
123 114
124 115 $variable->apply_changes( $data );
125 - $variable->validate();
126 116
127 117 $watermark = $this->repo->save( $collection );
128 118
129 119 if ( false === $watermark ) {
@@ -166,20 +156,15 @@
166 156 public function restore( string $id, $overrides = [] ) {
167 157 $collection = $this->repo->load();
168 158 $variable = $collection->find_or_fail( $id );
169 159
170 - $label = $variable->label();
160 + $collection->assert_limit_not_reached();
171 161
172 162 if ( isset( $overrides['label'] ) ) {
173 - $label = $overrides['label'];
163 + $collection->assert_label_is_unique( $overrides['label'], $variable->id() );
174 164 }
175 165
176 - $collection->assert_limit_not_reached();
177 -
178 - $collection->assert_label_is_unique( $label, $variable->id() );
179 -
180 166 $variable->apply_changes( $overrides );
181 - $variable->validate();
182 167
183 168 $variable->restore();
184 169
185 170 $watermark = $this->repo->save( $collection );