← All changes
|
modules/variables/services/variables-service.php
+0
-33
4.2.0-dev2
→
4.0.0-dev4
View file →
| @@ -23,41 +23,8 @@ | ||
| 23 | 23 | public function get_variables_list(): array { |
| 24 | 24 | return $this->load()['data']; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function find_by_label_or_id( string $needle ): ?array { | |
| 28 | - $needle = trim( $needle ); | |
| 29 | - $needle = ltrim( $needle, '-' ); | |
| 30 | - | |
| 31 | - if ( '' === $needle ) { | |
| 32 | - return null; | |
| 33 | - } | |
| 34 | - | |
| 35 | - $variables = $this->get_variables_list(); | |
| 36 | - | |
| 37 | - if ( isset( $variables[ $needle ] ) ) { | |
| 38 | - $variable = $variables[ $needle ]; | |
| 39 | - | |
| 40 | - if ( ! empty( $variable['deleted'] ) ) { | |
| 41 | - return null; | |
| 42 | - } | |
| 43 | - | |
| 44 | - return array_merge( [ 'id' => $needle ], $variable ); | |
| 45 | - } | |
| 46 | - | |
| 47 | - foreach ( $variables as $id => $variable ) { | |
| 48 | - if ( ! empty( $variable['deleted'] ) ) { | |
| 49 | - continue; | |
| 50 | - } | |
| 51 | - | |
| 52 | - if ( strcasecmp( $variable['label'] ?? '', $needle ) === 0 ) { | |
| 53 | - return array_merge( [ 'id' => $id ], $variable ); | |
| 54 | - } | |
| 55 | - } | |
| 56 | - | |
| 57 | - return null; | |
| 58 | - } | |
| 59 | - | |
| 60 | 27 | public function load() { |
| 61 | 28 | $collection = $this->repo->load()->serialize( true ); |
| 62 | 29 | foreach ( $collection['data'] as $id => $variable ) { |
| 63 | 30 | if ( ! ElementorUtils::has_pro() && Size_Variable_Prop_Type::get_key() === $variable['type'] ) { |