| @@ -5,13 +5,12 @@ | ||
| 5 | 5 | if ( ! defined( 'ABSPATH' ) ) { |
| 6 | 6 | exit; // Exit if accessed directly. |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -use Elementor\Modules\AtomicWidgets\OptIn\Opt_In; | |
| 9 | +use Elementor\Modules\AtomicWidgets\Opt_In; | |
| 10 | 10 | use Elementor\Plugin; |
| 11 | 11 | use Elementor\Utils; |
| 12 | 12 | use Elementor\Core\Utils\Api\Parse_Result; |
| 13 | -use Elementor\Modules\AtomicWidgets\Styles\Style_States; | |
| 14 | 13 | |
| 15 | 14 | class Style_Parser { |
| 16 | 15 | const VALID_TYPES = [ |
| 17 | 16 | 'class', |
| @@ -16,8 +15,14 @@ | ||
| 16 | 15 | const VALID_TYPES = [ |
| 17 | 16 | 'class', |
| 18 | 17 | ]; |
| 19 | 18 | |
| 19 | + const VALID_STATES = [ | |
| 20 | + 'hover', | |
| 21 | + 'active', | |
| 22 | + 'focus', | |
| 23 | + null, | |
| 24 | + ]; | |
| 20 | 25 | |
| 21 | 26 | private array $schema; |
| 22 | 27 | |
| 23 | 28 | public function __construct( array $schema ) { |
| @@ -162,9 +167,9 @@ | ||
| 162 | 167 | |
| 163 | 168 | return $result; |
| 164 | 169 | } |
| 165 | 170 | |
| 166 | - if ( ! array_key_exists( 'state', $meta ) || ! Style_States::is_valid_state( $meta['state'] ) ) { | |
| 171 | + if ( ! array_key_exists( 'state', $meta ) || ! in_array( $meta['state'], self::VALID_STATES, true ) ) { | |
| 167 | 172 | $result->errors()->add( 'state', 'missing_or_invalid_value' ); |
| 168 | 173 | |
| 169 | 174 | return $result; |
| 170 | 175 | } |
| @@ -229,12 +234,8 @@ | ||
| 229 | 234 | } |
| 230 | 235 | |
| 231 | 236 | if ( isset( $style['id'] ) ) { |
| 232 | 237 | $style['id'] = sanitize_key( $style['id'] ); |
| 233 | - } | |
| 234 | - | |
| 235 | - if ( isset( $style['sync_to_v3'] ) ) { | |
| 236 | - $style['sync_to_v3'] = (bool) $style['sync_to_v3']; | |
| 237 | 238 | } |
| 238 | 239 | |
| 239 | 240 | if ( ! empty( $style['variants'] ) ) { |
| 240 | 241 | foreach ( $style['variants'] as $variant_index => $variant ) { |