PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.7
Elementor Website Builder – more than just a page builder v3.35.7
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
← All changes | modules/variables/storage/entities/variable.php +1 -23 4.2.0-beta23.35.7 View file →
@@ -4,9 +4,8 @@
4 4
5 5 use Elementor\Modules\Variables\Adapters\Prop_Type_Adapter;
6 6 use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type;
7 7 use Elementor\Modules\Variables\Storage\Exceptions\Type_Mismatch;
8 -use Elementor\Modules\Variables\Storage\Exceptions\InvalidVariable;
9 8 use InvalidArgumentException;
10 9
11 10 class Variable {
12 11 private array $data;
@@ -130,15 +129,10 @@
130 129
131 130 return true;
132 131 }
133 132
134 - /**
135 - * @throws InvalidVariable If the variable is not valid.
136 - */
137 133 public function apply_changes( array $data ): void {
138 - $this->validate();
139 -
140 - $allowed_fields = [ 'label', 'value', 'order', 'type', 'sync_to_v3' ];
134 + $allowed_fields = [ 'label', 'value', 'order', 'type' ];
141 135 $has_changes = $this->maybe_apply_type( $data );
142 136
143 137 foreach ( $allowed_fields as $field ) {
144 138 if ( isset( $data[ $field ] ) ) {
@@ -150,22 +144,6 @@
150 144
151 145 if ( $has_changes ) {
152 146 $this->data['updated_at'] = $this->now();
153 147 }
154 - }
155 -
156 - /**
157 - * @return bool True if the variable is valid, throws an exception otherwise.
158 - * @throws InvalidVariable If the variable is not valid.
159 - */
160 - public function validate(): bool {
161 - if ( strpos( $this->label(), ' ' ) !== false ) {
162 - throw new InvalidVariable( 'Label cannot contain spaces' );
163 - }
164 -
165 - if ( strlen( $this->label() ) > 50 ) {
166 - throw new InvalidVariable( 'Label cannot be longer than 50 characters' );
167 - }
168 -
169 - return true;
170 148 }
171 149 }